Source of file Dispatch.php
Size: 1,001 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/View/Helper/Dispatch.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\View\Helper; use Bluz\Application\Application; use Bluz\Application\Exception\ForbiddenException; use Bluz\View\View; /** * Dispatch controller View Helper * * Example of usage: * $this->dispatch($module, $controller, array $params); * * @param string $module * @param string $controller * @param array $params * * @return View|string|null */ return function ($module, $controller, $params = []) { /** * @var View $this */ try { $view = Application::getInstance()->dispatch($module, $controller, $params); } catch (ForbiddenException $e) { // nothing for ForbiddenException return null; } catch (\Exception $e) { return $this->exception($e); } // run closure return value($view); }; |