本文整理汇总了PHP中ViewFactory::getView方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewFactory::getView方法的具体用法?PHP ViewFactory::getView怎么用?PHP ViewFactory::getView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewFactory
的用法示例。
在下文中一共展示了ViewFactory::getView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getView
/**
* Returns the view to display.
*
* @return string
* @todo select view instance based on controller name
*/
public function getView($controllerName, $result)
{
// On redirect, load default view object and tell it to redirect.
if (isset($this->redirects[$controllerName][$result])) {
$view = $this->viewFactory->getView();
$view->setRedirect($this->redirects[$controllerName][$result]);
return $view;
}
// If no view script is configured, we don't know what to do.
if (!isset($this->views[$controllerName][$result])) {
throw new Exception('Controller "' . $controllerName . '" result "' . $result . '" has no view script');
}
// Get the "real" view object (depending on the view script).
$view = $this->viewFactory->getView($this->views[$controllerName][$result]);
return $view;
}
示例2: indexAction
public function indexAction()
{
/* Once upon a time $shapes was extracted from $_REQUEST and successfully validated.
* And now $shapes is array like this:
* $shapes = [
* ['type' => 'circle', 'params' => [...]],
* ['type' => 'circle', 'params' => [...]]
* ];
*
* We believe in it.
*/
$shapes = Request::getShapes();
$shapes = new ShapesCollection($shapes);
$view = ViewFactory::getView(Request::getViewType());
while ($shape = $shapes->getShape()) {
$view->assignShape($shape);
}
$view->render();
}
示例3: testDefaultMapperCanBeConstructed
/**
* @covers ViewFactory::getView
*/
public function testDefaultMapperCanBeConstructed()
{
$viewFactory = new ViewFactory();
$this->assertInstanceOf('StdClass', $viewFactory->getView('StdClass', new Request(), new Response()));
}