Overview

Namespaces

  • Minion
    • Service
    • Twig

Classes

  • Minion\Application
  • Minion\Console
  • Minion\Controller
  • Minion\Service\ServiceConfig
  • Minion\Service\ServiceProvider
  • Minion\Twig\AssetExtension
  • Minion\Twig\MiscExtension
  • Minion\Twig\TwigExtensionTagServiceProvider
  • Minion\Twig\UrlExtension
  • Minion\Utils

Interfaces

  • Minion\ControllerInterface
  • Minion\Service\ServiceConfigInterface
  • Minion\Service\ServiceProviderInterface
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Minion package.
 5:  * For the full copyright and license information, please view the LICENSE
 6:  * file that was distributed with this source code.
 7:  *
 8:  * @license MIT License
 9:  */
10: 
11: namespace Minion\Twig;
12: 
13: use Minion\Service\ServiceProvider;
14: use Silex\Application as SilexApp;
15: 
16: /**
17:  * {@internal it is NOT RECOMMENDED to use it outside Minion package}}
18:  *
19:  * Class TwigExtensionTagServiceProvider.
20:  *
21:  * Allow to extend twig environment by registering extension as a service.
22:  *
23:  * @package Minion
24:  * @author Damian SzczerbiƄski <dszczer@gmail.com>
25:  */
26: class TwigExtensionTagServiceProvider extends ServiceProvider
27: {
28:     /**
29:      * Extend Twig Environment with provided Extension.
30:      *
31:      * @param SilexApp $app
32:      *
33:      * @return void
34:      */
35:     public function register(SilexApp $app) {
36:         $app['twig'] = $app->share($app->extend('twig', function (\Twig_Environment $twig, SilexApp $app) {
37:             $class = $this->getServiceConfig()->getProviderClass();
38:             $twig->addExtension(new $class);
39: 
40:             return $twig;
41:         }));
42:     }
43: 
44:     /**
45:      * {@inheritdoc}
46:      */
47:     public function boot(SilexApp $app) {}
48: }
API documentation generated by ApiGen