@@ -108,7 +108,7 @@ |
||
| 108 | 108 | */ |
| 109 | 109 | public function timelineData(): array |
| 110 | 110 | { |
| 111 | - if (! $this->hasTimeline) { |
|
| 111 | + if (!$this->hasTimeline) { |
|
| 112 | 112 | return []; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | */ |
| 85 | 85 | protected function collectLogs() |
| 86 | 86 | { |
| 87 | - if (! empty($this->data)) { |
|
| 87 | + if (!empty($this->data)) { |
|
| 88 | 88 | return $this->data; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | foreach (\CodeIgniter\Events\Events::getPerformanceLogs() as $row) { |
| 101 | 101 | $key = $row['event']; |
| 102 | 102 | |
| 103 | - if (! array_key_exists($key, $data['events'])) { |
|
| 103 | + if (!array_key_exists($key, $data['events'])) { |
|
| 104 | 104 | $data['events'][$key] = [ |
| 105 | 105 | 'event' => $key, |
| 106 | 106 | 'duration' => ($row['end'] - $row['start']) * 1000, |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
| 89 | 89 | |
| 90 | - if (! is_cli()) { |
|
| 90 | + if (!is_cli()) { |
|
| 91 | 91 | // when called in the browser, the first two trace arrays |
| 92 | 92 | // are from the DB event trigger, which are unneeded |
| 93 | 93 | $backtrace = array_slice($backtrace, 2); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function display(): array |
| 141 | 141 | { |
| 142 | - $data['queries'] = array_map(static function (array $query) { |
|
| 142 | + $data['queries'] = array_map(static function(array $query) { |
|
| 143 | 143 | $isDuplicate = $query['duplicate'] === true; |
| 144 | 144 | |
| 145 | 145 | $firstNonSystemLine = ''; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $this->getConnections(); |
| 210 | 210 | |
| 211 | 211 | $queryCount = count(static::$queries); |
| 212 | - $uniqueCount = count(array_filter(static::$queries, static function ($query) { |
|
| 212 | + $uniqueCount = count(array_filter(static::$queries, static function($query) { |
|
| 213 | 213 | return $query['duplicate'] === false; |
| 214 | 214 | })); |
| 215 | 215 | $connectionCount = count($this->connections); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | public function start(string $name, ?float $time = null) |
| 43 | 43 | { |
| 44 | 44 | $this->timers[strtolower($name)] = [ |
| 45 | - 'start' => ! empty($time) ? $time : microtime(true), |
|
| 45 | + 'start' => !empty($time) ? $time : microtime(true), |
|
| 46 | 46 | 'end' => null, |
| 47 | 47 | ]; |
| 48 | 48 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->config = $config; |
| 53 | 53 | |
| 54 | 54 | foreach ($config->collectors as $collector) { |
| 55 | - if (! class_exists($collector)) { |
|
| 55 | + if (!class_exists($collector)) { |
|
| 56 | 56 | log_message('critical', 'Toolbar collector does not exists(' . $collector . ').' . |
| 57 | 57 | 'please check $collectors in the Config\Toolbar.php file.'); |
| 58 | 58 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $data['vars']['varData'][esc($heading)] = $varData; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if (! empty($_SESSION)) { |
|
| 121 | + if (!empty($_SESSION)) { |
|
| 122 | 122 | foreach ($_SESSION as $key => $value) { |
| 123 | 123 | // Replace the binary data with string to avoid json_encode failure. |
| 124 | 124 | if (is_string($value) && preg_match('~[^\x20-\x7E\t\r\n]~', $value)) { |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | $output = ''; |
| 185 | 185 | |
| 186 | 186 | foreach ($rows as $row) { |
| 187 | - $hasChildren = isset($row['children']) && ! empty($row['children']); |
|
| 188 | - $isQuery = isset($row['query']) && ! empty($row['query']); |
|
| 187 | + $hasChildren = isset($row['children']) && !empty($row['children']); |
|
| 188 | + $isQuery = isset($row['query']) && !empty($row['query']); |
|
| 189 | 189 | |
| 190 | 190 | // Open controller timeline by default |
| 191 | 191 | $open = $row['name'] === 'Controller'; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | // Collect it |
| 252 | 252 | foreach ($collectors as $collector) { |
| 253 | - if (! $collector['hasTimelineData']) { |
|
| 253 | + if (!$collector['hasTimelineData']) { |
|
| 254 | 254 | continue; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | array_multisort(...$sortArray); |
| 268 | 268 | |
| 269 | 269 | // Add end time to each element |
| 270 | - array_walk($data, static function (&$row) { |
|
| 270 | + array_walk($data, static function(&$row) { |
|
| 271 | 271 | $row['end'] = $row['start'] + $row['duration']; |
| 272 | 272 | }); |
| 273 | 273 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $element = array_shift($elements); |
| 287 | 287 | |
| 288 | 288 | // If we have children behind us, collect and attach them to us |
| 289 | - while (! empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
| 289 | + while (!empty($elements) && $elements[array_key_first($elements)]['end'] <= $element['end']) { |
|
| 290 | 290 | $element['children'][] = array_shift($elements); |
| 291 | 291 | } |
| 292 | 292 | |
@@ -310,14 +310,14 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | protected function collectVarData(): array |
| 312 | 312 | { |
| 313 | - if (! ($this->config->collectVarData ?? true)) { |
|
| 313 | + if (!($this->config->collectVarData ?? true)) { |
|
| 314 | 314 | return []; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | $data = []; |
| 318 | 318 | |
| 319 | 319 | foreach ($this->collectors as $collector) { |
| 320 | - if (! $collector->hasVarData()) { |
|
| 320 | + if (!$collector->hasVarData()) { |
|
| 321 | 321 | continue; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * @var IncomingRequest $request |
| 352 | 352 | * @var Response $response |
| 353 | 353 | */ |
| 354 | - if (CI_DEBUG && ! is_cli()) { |
|
| 354 | + if (CI_DEBUG && !is_cli()) { |
|
| 355 | 355 | global $app; |
| 356 | 356 | |
| 357 | 357 | $request = $request ?? Services::request(); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | // Updated to time() so we can get history |
| 377 | 377 | $time = time(); |
| 378 | 378 | |
| 379 | - if (! is_dir(WRITEPATH . 'debugbar')) { |
|
| 379 | + if (!is_dir(WRITEPATH . 'debugbar')) { |
|
| 380 | 380 | mkdir(WRITEPATH . 'debugbar', 0777); |
| 381 | 381 | } |
| 382 | 382 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $contents .= $v($this); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if (! \strlen($contents)) { |
|
| 33 | + if (!\strlen($contents)) { |
|
| 34 | 34 | continue; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Don't pre-render on every dump |
| 52 | - if (! $this->force_pre_render) { |
|
| 52 | + if (!$this->force_pre_render) { |
|
| 53 | 53 | self::$needs_pre_render = false; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | if (self::$needs_folder_render || $this->force_pre_render) { |
| 63 | 63 | $output = $this->renderFolder() . $output; |
| 64 | 64 | |
| 65 | - if (! $this->force_pre_render) { |
|
| 65 | + if (!$this->force_pre_render) { |
|
| 66 | 66 | self::$needs_folder_render = false; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $this->response = $response; |
| 73 | 73 | |
| 74 | 74 | // workaround for upgraded users |
| 75 | - if (! isset($this->config->sensitiveDataInTrace)) { |
|
| 75 | + if (!isset($this->config->sensitiveDataInTrace)) { |
|
| 76 | 76 | $this->config->sensitiveDataInTrace = []; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | [$statusCode, $exitCode] = $this->determineCodes($exception); |
| 103 | 103 | |
| 104 | - if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) { |
|
| 104 | + if ($this->config->log === true && !in_array($statusCode, $this->config->ignoreCodes, true)) { |
|
| 105 | 105 | log_message('critical', $exception->getMessage() . "\n{trace}", [ |
| 106 | 106 | 'trace' => $exception->getTraceAsString(), |
| 107 | 107 | ]); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (! is_cli()) { |
|
| 110 | + if (!is_cli()) { |
|
| 111 | 111 | $this->response->setStatusCode($statusCode); |
| 112 | 112 | header(sprintf('HTTP/%s %s %s', $this->request->getProtocolVersion(), $this->response->getStatusCode(), $this->response->getReasonPhrase()), true, $statusCode); |
| 113 | 113 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function errorHandler(int $severity, string $message, ?string $file = null, ?int $line = null) |
| 138 | 138 | { |
| 139 | - if (! (error_reporting() & $severity)) { |
|
| 139 | + if (!(error_reporting() & $severity)) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $viewFile = $altPath . $altView; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if (! isset($viewFile)) { |
|
| 219 | + if (!isset($viewFile)) { |
|
| 220 | 220 | echo 'The error view files were not found. Cannot render exception trace.'; |
| 221 | 221 | |
| 222 | 222 | exit(1); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | ob_end_clean(); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - echo(function () use ($exception, $statusCode, $viewFile): string { |
|
| 229 | + echo(function() use ($exception, $statusCode, $viewFile): string { |
|
| 230 | 230 | $vars = $this->collectVars($exception, $statusCode); |
| 231 | 231 | extract($vars, EXTR_SKIP); |
| 232 | 232 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | public static function highlightFile(string $file, int $lineNumber, int $lines = 15) |
| 368 | 368 | { |
| 369 | - if (empty($file) || ! is_readable($file)) { |
|
| 369 | + if (empty($file) || !is_readable($file)) { |
|
| 370 | 370 | return false; |
| 371 | 371 | } |
| 372 | 372 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected function fail($messages, int $status = 400, ?string $code = null, string $customMessage = '') |
| 125 | 125 | { |
| 126 | - if (! is_array($messages)) { |
|
| 126 | + if (!is_array($messages)) { |
|
| 127 | 127 | $messages = ['error' => $messages]; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -320,14 +320,14 @@ discard block |
||
| 320 | 320 | $mime = "application/{$this->format}"; |
| 321 | 321 | |
| 322 | 322 | // Determine correct response type through content negotiation if not explicitly declared |
| 323 | - if (empty($this->format) || ! in_array($this->format, ['json', 'xml'], true)) { |
|
| 323 | + if (empty($this->format) || !in_array($this->format, ['json', 'xml'], true)) { |
|
| 324 | 324 | $mime = $this->request->negotiate('media', $format->getConfig()->supportedResponseFormats, false); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | $this->response->setContentType($mime); |
| 328 | 328 | |
| 329 | 329 | // if we don't have a formatter, make one |
| 330 | - if (! isset($this->formatter)) { |
|
| 330 | + if (!isset($this->formatter)) { |
|
| 331 | 331 | // if no formatter, use the default |
| 332 | 332 | $this->formatter = $format->getFormatter($mime); |
| 333 | 333 | } |