コード例 #1
0
 /**
  * Create a view for the object.
  *
  * @param $object
  *
  * @return View
  */
 public function createView($object)
 {
     $view = $this->viewFactory->createView($object);
     if ($view instanceof View) {
         $this->extend($view, $object);
     }
     return $view;
 }
コード例 #2
0
ファイル: RootViewFactory.php プロジェクト: shopery/view
 /**
  * Create a view for the object, allows arrays recursively
  *
  * @param $object
  *
  * @return View
  *
  * @throws Exception\UnsupportedObjectException
  */
 public function createView($object)
 {
     if (is_array($object)) {
         return array_map([$this, 'createView'], $object);
     }
     $view = $this->factory->createView($object);
     if (false === $view instanceof View) {
         return $this->notSuitableFactoryFor($object);
     }
     if ($view instanceof RootViewFactoryAware) {
         $view->setRootViewFactory($this);
     }
     return $view;
 }