/** * @param ReflectionProperty $refl * @return string */ public function getServiceName(ReflectionProperty $refl) { $annotation = AnnotationHelper::getAnnotation($refl, Qualifier::class); if ($annotation) { return $annotation->value; } return null; }
$viewPath = null; $viewFolder = str_ireplace("Controller", "", $route['controller']); if (isset($actionResult->viewName)) { $view = $actionResult->viewName . ".php"; if (isset($route['area'])) { $viewPath = PATH_TO_APP . "areas" . DS . $route['area'] . DS . "views" . DS . $viewFolder . DS . $actionResult->viewName . ".php"; } else { $viewPath = PATH_TO_APP . "views" . DS . $viewFolder . DS . $actionResult->viewName . ".php"; } } else { if (isset($route['area'])) { $viewPath = PATH_TO_APP . "areas" . DS . $route['area'] . DS . "views" . DS . $viewFolder . DS . $route['method'] . ".php"; } else { $viewPath = PATH_TO_APP . "views" . DS . $viewFolder . DS . $route['method'] . ".php"; } } $expectedViewModel = AnnotationHelper::getViewModelType($viewPath); if (isset($expectedViewModel)) { $expectedViewModel = explode("/", $expectedViewModel)[1]; if (is_object($actionResult->model)) { if (get_class($actionResult->model) !== $expectedViewModel) { die("The view '" . $viewPath . "' expects a " . $expectedViewModel . ".\n The actual one is " . get_class($actionResult->model) . "."); } $actionResult->render($viewPath); } else { die("The view '" . explode(".", $view)[0] . "' expects a " . $expectedViewModel . "."); } } else { $actionResult->render($viewPath); } }