예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function register()
 {
     $this->container->registerSingleton([ViewFactory::class, 'view'], function ($container) {
         $app = $container->get('app');
         $applicationPath = $app->getPath();
         $fileSystem = $container->get('fileSystem');
         // Create factory instance
         $factory = new ViewFactory($fileSystem, $applicationPath . '/resources/views', $app->getCharset());
         // Register template renderer
         $factory->registerRenderer('.tpl.php', function () use($applicationPath, $fileSystem) {
             return new Template($fileSystem, $applicationPath . '/storage/cache/views');
         });
         // Return factory instance
         return $factory;
     });
 }