* @copyright Copyright (c) 2013 - 2019, TechFuze. (http://techfuze.net) */ class RouterCallViewEvent extends Event { /** * The function that will be loaded in the view * * @var array */ public $viewMethods; /** * The parameters that will be provided to the function in the view * * @var string */ public $viewParameters; /** * The route that resulted in this controller and view * * @var string */ public $route; /** * The view the method will be called on * * @var View */ public $view; /** * The controller that's associated with this View * * @var Controller */ public $controller; public function init(View $view, Controller $controller, array $viewMethods, string $viewParameters, string $route) { $this->view = $view; $this->controller = $controller; $this->viewMethods = $viewMethods; $this->viewParameters = $viewParameters; $this->route = $route; } /** * Add a method which should be tried upon calling the view * * @param string $method * @param int $priority */ public function addMethod(string $method, int $priority = Priority::NORMAL) { if (!isset($this->viewMethods[$priority])) $this->viewMethods[$priority] = []; if (!isset($this->viewMethods[$priority][$method])) $this->viewMethods[$priority][] = $method; } }