Ejemplo n.º 1
0
 /**
  * factory method - create view object for given controller and method name
  *
  * @param string $controllerName
  * @param string $methodName
  * @param array $data
  * @param string $format
  *
  * @return WikiaView
  */
 public static function newFromControllerAndMethodName($controllerName, $methodName, array $data = [], $format = WikiaResponse::FORMAT_HTML)
 {
     // Service classes must be dispatched by full name otherwise we default to a controller.
     $controllerClassName = self::normalizeControllerClass($controllerName);
     $response = new WikiaResponse($format);
     $response->setControllerName($controllerName);
     $response->setMethodName($methodName);
     $response->setData($data);
     /* @var $controllerClassName WikiaController */
     $response->setTemplateEngine($controllerClassName::DEFAULT_TEMPLATE_ENGINE);
     return $response->getView();
 }