} // Set our prettify options. if ($options['prettify']) { \ProfilerRenderer::setIncludePrettify(true); \ProfilerRenderer::setPrettifyLocation($options['prettify']); } else { \ProfilerRenderer::setIncludePrettify(false); } /** * Due to the way the `Environment` class determines the current configuration * we need to wait for the `Dispatcher` to start up before we know where we are. */ Filters::apply('lithium\\action\\Dispatcher', '_callable', function ($self, $params, $chain) { if (!Environment::is(Libraries::get('li3_profiler', 'environment'))) { // Enable the profiler. \Profiler::disable(); } else { $controller = $chain->next($self, $params, $chain); if (Libraries::get('li3_profiler', 'inject')) { /** * If we have a `Controller` object we will filter it so that we can * inject our rendering HTML. */ if (is_a($controller, '\\lithium\\action\\Controller')) { $controller->applyFilter('__invoke', function ($self, $params, $chain) { $response = $chain->next($self, $params, $chain); if ($response->type === 'text/html') { /** * Here we tack in our rendering if the `Response` object happens * to be "text/html" and we are enabled. */
/** * show post debug * * @param string $key * @return Response */ protected function postDump($key) { Profiler::disable(); $post = Post::find($key); ob_start(); var_dump($post); $dump = ob_get_clean(); $response = Response::make($dump); $response->header('charset', 'utf-8'); return $response; }