[Bridge\Twig] Lazy-load deps
This commit is contained in:
parent
2dbe17b9e9
commit
3fc766ff4b
@ -32,7 +32,7 @@ class DumpExtension extends AbstractExtension
|
|||||||
public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
|
public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
|
||||||
{
|
{
|
||||||
$this->cloner = $cloner;
|
$this->cloner = $cloner;
|
||||||
$this->dumper = $dumper ?: new HtmlDumper();
|
$this->dumper = $dumper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFunctions()
|
public function getFunctions()
|
||||||
@ -73,6 +73,7 @@ class DumpExtension extends AbstractExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dump = fopen('php://memory', 'r+b');
|
$dump = fopen('php://memory', 'r+b');
|
||||||
|
$this->dumper = $this->dumper ?: new HtmlDumper();
|
||||||
$this->dumper->setCharset($env->getCharset());
|
$this->dumper->setCharset($env->getCharset());
|
||||||
|
|
||||||
foreach ($vars as $value) {
|
foreach ($vars as $value) {
|
||||||
|
@ -34,10 +34,6 @@ class TranslationExtension extends AbstractExtension
|
|||||||
|
|
||||||
public function __construct(TranslatorInterface $translator = null, NodeVisitorInterface $translationNodeVisitor = null)
|
public function __construct(TranslatorInterface $translator = null, NodeVisitorInterface $translationNodeVisitor = null)
|
||||||
{
|
{
|
||||||
if (!$translationNodeVisitor) {
|
|
||||||
$translationNodeVisitor = new TranslationNodeVisitor();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->translationNodeVisitor = $translationNodeVisitor;
|
$this->translationNodeVisitor = $translationNodeVisitor;
|
||||||
}
|
}
|
||||||
@ -84,12 +80,12 @@ class TranslationExtension extends AbstractExtension
|
|||||||
*/
|
*/
|
||||||
public function getNodeVisitors()
|
public function getNodeVisitors()
|
||||||
{
|
{
|
||||||
return array($this->translationNodeVisitor, new TranslationDefaultDomainNodeVisitor());
|
return array($this->getTranslationNodeVisitor(), new TranslationDefaultDomainNodeVisitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTranslationNodeVisitor()
|
public function getTranslationNodeVisitor()
|
||||||
{
|
{
|
||||||
return $this->translationNodeVisitor;
|
return $this->translationNodeVisitor ?: $this->translationNodeVisitor = new TranslationNodeVisitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function trans($message, array $arguments = array(), $domain = null, $locale = null)
|
public function trans($message, array $arguments = array(), $domain = null, $locale = null)
|
||||||
|
Reference in New Issue
Block a user