protected function createHtmlReport($exception) { $actionView = new ActionView(); $actionView->lookupContext()->addPath(__DIR__ . '/templates'); $assigns = new Assigns(['application' => $this->application, 'exception' => $exception]); $helperSet = new HelperSet(); $helperSet->addHelper(new ReporterHelper($helperSet)); $presenter = new ExceptionPresenter($helperSet); $helperSet->invoke('setPresenter', [$presenter]); $renderParams = ['partial' => false, 'layout' => 'layout', 'prefixes' => [], 'details' => ['locale' => [], 'handlers' => ['php'], 'formats' => []], 'assigns' => $assigns, 'helperSet' => $helperSet]; $contents = []; $contents[] = $this->renderException($exception, $actionView, $presenter, $renderParams); if ($previous = $exception->getPrevious()) { while ($previous) { $contents[] = $this->renderException($previous, $actionView, $presenter, $renderParams); $previous = $previous->getPrevious(); } } return implode("\n", $contents); }
public static function dispatchRequest($app) { $actionView = new ActionView(); $actionView->lookupContext()->addPath(__DIR__ . '/templates'); $actionView->lookupContext()->addPath(__DIR__ . '/../../ActionDispatch/ErrorReporting/templates'); $assigns = new Assigns(['routes' => $app->routes()]); $helperSet = new HelperSet($app->request(), $app->parameters()); $helperSet->setRouteSet($app->routes()); $actionView->setHelperSet($helperSet); $presenter = new RoutePresenter($helperSet); $helperSet->invoke('setPresenter', [$presenter]); switch ($app->parameters()->action) { case 'routes': $contents = $actionView->renderTemplate('routes', ['partial' => false, 'layout' => 'layout', 'prefixes' => [], 'assigns' => $assigns, 'helperSet' => $helperSet, 'details' => ['locale' => [], 'handlers' => ['php'], 'formats' => []]]); $app->response()->setBody($contents); break; default: $app->response()->setLocation($app->routes()->pathFor('railsInfo', ['action' => 'routes'])); break; } }
protected function _run() { ActionView::clean_buffers(); ob_start(); $this->_dispatcher->find_route(); if ($this->dispatcher()->router()->route()->assets_route()) { Rails::assets()->server()->dispatch_request(); } else { if ($this->dispatcher()->router()->route()->rails_admin()) { self::setPanelConfig(); } $this->_load_controller(); $this->controller()->run_request_action(); } $this->_dispatcher->respond(); }