예제 #1
0
 /**
  * Get the data bound to the view instance.
  *
  * @return array
  */
 protected function gatherData() : array
 {
     $data = array_merge($this->factory->getShared(), $this->data);
     foreach ($data as $key => $value) {
         if ($value instanceof Renderable) {
             $data[$key] = $value->render();
         } elseif ($value instanceof Closure) {
             $data[$key] = call_user_func($value);
         }
     }
     return $data;
 }
예제 #2
0
 public static function createViewFactory(ContainerInterface $container)
 {
     $view = new Factory($container->get(EngineResolver::class), $container->get(ViewFinder::class));
     $view->share('app', $container);
     $view->addExtension('html', 'twig');
     $view->addExtension('twig.html', 'twig');
     $view->addExtension('plates.php', 'plates');
     return $view;
 }