/** * 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; }
/** * 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; }