function inspect() { $VMFilter = function ($k, $v, $o) { if ($v instanceof KernelSettings || $v instanceof NavigationInterface || $v instanceof NavigationLinkInterface || $v instanceof SessionInterface || $v instanceof ServerRequestInterface || $v instanceof DocumentContext || $v instanceof Component) { return '...'; } return true; }; return _log()->getTable([Debug::getType($this->viewModel) => Debug::RAW_TEXT . _log()->getTable($this->viewModel, '', true, true, 2, $VMFilter), is_null($this->props) ? 'Properties' : Debug::getType($this->props) => Debug::RAW_TEXT . _log()->getTable($this->props, '', true, true, 1, ['props', 'component', 'hidden'])], Debug::getType($this)); }
/** * Invokes a request handler. * * <p>The router does not call handlers directly; instead, it does it trough this method, so that calls can be * intercepted, validated and logged. * * > This method also functions as a router extension point. * * @param callable $handler * @param ServerRequestInterface $request * @param ResponseInterface $response * @param callable $next * @return ResponseInterface */ protected function callHandler(callable $handler, ServerRequestInterface $request, ResponseInterface $response, callable $next) { $this->currentRequestMutator->set($request); if ($handler instanceof RenderableInterface) { $class = $handler->getContextClass(); $handler->setContext($this->injector->make($class)); } /*try { $response = $handler ($request, $response, $next); } catch (HttpException $error) { // Convert HTTP exceptions to normal responses $msg = $error->getTitle () ?: str_segmentsFirst ($error->getMessage (), "\n"); // use only the first line of text return $response->withStatus ($error->getCode (), $msg); }*/ $response = $handler($request, $response, $next); if (!$response) { throw new \RuntimeException(sprintf("Request handler <span class=__type>%s</span> did not return a response.", Debug::getType($handler))); } if (!$response instanceof ResponseInterface) { throw new \RuntimeException(sprintf("Response from request handler <span class=__type>%s</span> is not a <span class=type>ResponseInterface</span> implementation.", Debug::getType($handler))); } return $response; }
/** * @param mixed $val The value to be inspected. * @param mixed $alt If not null, a replacement for inspection; type information about $val is displayed but the * inspection is performed on this argument instead. * @return string */ private function getInspection2($val, $alt = null) { $arg = $this->table(isset($alt) ? $alt : $val); if (is_scalar($val) || is_null($val)) { $arg = '<i>(' . Debug::getType($val) . ")</i>{$arg}"; return "<#data>{$arg}</#data>"; } if ($val instanceof \PowerString) { return Debug::toString($val); } return $this->formatType($val, $arg); }
private function unwind($e) { $this->routingLogger->writef("<#row>%sUnwinding the stack...</#row>", self::$unwinding ? '' : '<span class=__alert>' . Debug::getType($e) . '</span> '); self::$unwinding = true; throw $e; }
protected function afterRender() { parent::afterRender(); //---------------------------------------------------------------------------------------- // View Model panel // (MUST run before the DOM panel to capture the data-binding stack at its current state) //---------------------------------------------------------------------------------------- DebugConsole::registerPanel('view', new ConsoleLogger('View', 'fa fa-eye')); $VMFilter = function ($k, $v, $o) { if ($v instanceof DocumentContext || $v instanceof Component || $k === 'parent' || $k === 'model') { return '...'; } return true; }; $expMap = Expression::$inspectionMap; ksort($expMap); DebugConsole::logger('view')->withFilter($VMFilter, $this->context)->write('<#section|Compiled expressions>')->inspect($expMap)->write('</#section>'); //------------ // Model panel //------------ DebugConsole::registerPanel('model', new ConsoleLogger('Model', 'fa fa-table')); $shadowDOM = $this->getShadowDOM(); if ($shadowDOM) { $VMFilter = function ($k, $v, $o) { if ($v instanceof KernelSettings || $v instanceof NavigationInterface || $v instanceof NavigationLinkInterface || $v instanceof SessionInterface || $v instanceof ServerRequestInterface || $v instanceof DocumentContext || $v instanceof Component) { return '...'; } return true; }; $binder = $shadowDOM->getDataBinder(); DebugConsole::logger('model')->write('<#i>PAGE DATA BINDER: ' . Debug::getType($binder) . "</#i>")->write("<#section|PAGE VIEW MODEL>")->withFilter($VMFilter, $binder->getViewModel())->write("</#section>"); } //----------- // DOM panel //----------- if ($this->matisseSettings->inspectDOM()) { DebugConsole::registerPanel('DOM', new ConsoleLogger('Server-side DOM', 'fa fa-sitemap')); $insp = $this->inspect(true); DebugConsole::logger('DOM')->write($insp); } }