private function loadTwig(Environment $twig)
    {
        foreach ($this->registerTwigFunctions() as $name => $options) {
            if (is_string($options)) {
                $this->addTwigFunction($name, $options);
            } else {
                $this->addTwigFunction($name, $options[0], isset($options[1]) ? $options[1] : []);
            }
        }

        foreach ($this->registerTwigFilters() as $name => $options) {
            if (is_string($options)) {
                $this->addTwigFilter($name, $options);
            } else {
                $this->addTwigFilter($name, $options[0], isset($options[1]) ? $options[1] : []);
            }
        }

        foreach ($this->registerTwigPaths() as $key => $value) {
            if (is_array($value)) {
                $this->addTwigPath($key, $value);
            } else {
                $this->addTwigPath($value);
            }
        }

        foreach ($this->twigFunctions as $twigFunction) {
            $twig->addFunction($twigFunction);
        }

        foreach ($this->twigFilters as $twigFilter) {
            $twig->addFilter($twigFilter);
        }

        $this->updateSandboxPolicy($twig);
    }
private function loadTwig(Environment $twig)
    {
        foreach ($this->registerTwigFunctions() as $name => $options) {
            if (is_string($options)) {
                $this->addTwigFunction($name, $options);
            } else {
                $this->addTwigFunction($name, $options[0], isset($options[1]) ? $options[1] : []);
            }
        }

        foreach ($this->registerTwigFilters() as $name => $options) {
            if (is_string($options)) {
                $this->addTwigFilter($name, $options);
            } else {
                $this->addTwigFilter($name, $options[0], isset($options[1]) ? $options[1] : []);
            }
        }

        foreach ($this->registerTwigPaths() as $key => $value) {
            if (is_array($value)) {
                $this->addTwigPath($key, $value);
            } else {
                $this->addTwigPath($value);
            }
        }

        foreach ($this->twigFunctions as $twigFunction) {
            $twig->addFunction($twigFunction);
        }

        foreach ($this->twigFilters as $twigFilter) {
            $twig->addFilter($twigFilter);
        }

        $this->updateSandboxPolicy($twig);
    }
private function loadTwig ( Environment $ twig ) { foreach ( $ this -> registerTwigFunctions ( ) as $ name => $ options ) { if ( is_string ( $ options ) ) { $ this -> addTwigFunction ( $ name , $ options ) ; } else { $ this -> addTwigFunction ( $ name , $ options [ 0 ] , isset ( $ options [ 1 ] ) ? $ options [ 1 ] : [ ] ) ; } } foreach ( $ this -> registerTwigFilters ( ) as $ name => $ options ) { if ( is_string ( $ options ) ) { $ this -> addTwigFilter ( $ name , $ options ) ; } else { $ this -> addTwigFilter ( $ name , $ options [ 0 ] , isset ( $ options [ 1 ] ) ? $ options [ 1 ] : [ ] ) ; } } foreach ( $ this -> registerTwigPaths ( ) as $ key => $ value ) { if ( is_array ( $ value ) ) { $ this -> addTwigPath ( $ key , $ value ) ; } else { $ this -> addTwigPath ( $ value ) ; } } foreach ( $ this -> twigFunctions as $ twigFunction ) { $ twig -> addFunction ( $ twigFunction ) ; } foreach ( $ this -> twigFilters as $ twigFilter ) { $ twig -> addFilter ( $ twigFilter ) ; } $ this -> updateSandboxPolicy ( $ twig ) ; }
Adds filters and functions to Twig Environment.

@param Environment $twig
Adds filters and functions to Twig Environment .