public function dd($status = 206, $analizeResponse = false)
{
// Try to take these values as soon as posible
$time = microtime(true);
$memoryUsage = formatMemSize(memory_get_usage());
// CLI response
if (\App::runningInConsole()) {
$result = $this->collectorMan->getRaw();
dump($result);
return;
}
// Json respnse
if (request()->wantsJson()) {
$title = $status == 206 ? 'DD' : "UNCAUGHT EXCEPTION";
header("status: {$status}", true);
header("Content-Type: application/json", true);
$collectorData = request()->headers->has('laravel-inspector') ? $this->collectorMan->getScripts('inspector', $title, $status) : $this->collectorMan->getPreJson('inspector');
if ($analizeResponse) {
// Respond the payload also
$collectorData = array_merge(json_decode($this->response->getContent(), true), ['LARAVEL_INSPECTOR' => $collectorData]);
} else {
$collectorData = ['LARAVEL_INSPECTOR' => $collectorData];
}
echo json_encode($collectorData);
die;
} else {
// Fullscreen dd
// Get collectors bag ready for fullscreen view
$collectorData = $this->collectorMan->getFs();
try {
$view = (string) view('inspector::fullscreen', ['analizeView' => $analizeResponse, 'collectors' => $collectorData, 'memoryUsage' => $memoryUsage, 'time' => round(($time - LARAVEL_START) * 1000, 2)]);
echo $view;
die;
} catch (\Exception $e) {
dump($e);
die;
}
}
}