@@ -26,7 +26,8 @@ |
||
26 | 26 | if (!empty($this->hooks)) { |
27 | 27 | return $this->hooks; |
28 | 28 | } |
29 | - array_walk($this->entries, function (&$data) { |
|
29 | + array_walk($this->entries, function (&$data) |
|
30 | + { |
|
30 | 31 | $total = $this->totalTimeForHook($data); |
31 | 32 | $perCall = (int) round($total / $data['count']); |
32 | 33 | $data['per_call'] = $this->formatTime($perCall); |
@@ -13,7 +13,8 @@ discard block |
||
13 | 13 | 'FROM', 'GROUP BY', 'INNER JOIN', 'LEFT JOIN', 'LIMIT', |
14 | 14 | 'ON DUPLICATE KEY UPDATE', 'ORDER BY', 'OFFSET', ' SET', 'WHERE', |
15 | 15 | ]; |
16 | - $replace = array_map(function ($value) { |
|
16 | + $replace = array_map(function ($value) |
|
17 | + { |
|
17 | 18 | return PHP_EOL.$value; |
18 | 19 | }, $search); |
19 | 20 | foreach ($wpdb->queries as $query) { |
@@ -22,7 +23,8 @@ discard block |
||
22 | 23 | $sql = str_replace(['( ', ' )', ' ,'], ['(', ')', ','], $sql); |
23 | 24 | $sql = str_replace($search, $replace, $sql); |
24 | 25 | $parts = explode(PHP_EOL, $sql); |
25 | - $sql = array_reduce($parts, function ($carry, $part) { |
|
26 | + $sql = array_reduce($parts, function ($carry, $part) |
|
27 | + { |
|
26 | 28 | if (str_starts_with($part, 'SELECT') && strlen($part) > 100) { |
27 | 29 | $part = preg_replace('/\s*(,)\s*/', ','.PHP_EOL.' ', $part); |
28 | 30 | } |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | defined('WPINC') || exit; |
4 | 4 | |
5 | -spl_autoload_register(function ($className) { |
|
5 | +spl_autoload_register(function ($className) |
|
6 | +{ |
|
6 | 7 | $namespaces = [ |
7 | 8 | 'GeminiLabs\\BlackBar\\' => __DIR__.'/plugin/', |
8 | 9 | 'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/', |
@@ -56,10 +56,12 @@ |
||
56 | 56 | { |
57 | 57 | if ('noise' === $property) { |
58 | 58 | $this->noise = (int) hrtime(true) - $this->start; |
59 | - } elseif ('start' === $property) { |
|
59 | + } |
|
60 | + elseif ('start' === $property) { |
|
60 | 61 | $this->start = (int) hrtime(true); |
61 | 62 | $this->memory_start = memory_get_peak_usage(); |
62 | - } elseif ('stop' === $property) { |
|
63 | + } |
|
64 | + elseif ('stop' === $property) { |
|
63 | 65 | $this->stop = (int) hrtime(true); |
64 | 66 | $this->memory_stop = memory_get_peak_usage(); |
65 | 67 | } |
@@ -71,10 +71,12 @@ |
||
71 | 71 | if (str_starts_with($hook, 'blackbar/profiler/')) { |
72 | 72 | $property = str_replace('blackbar/profiler/', '', $hook); |
73 | 73 | $this->app->profiler->set($property); |
74 | - } elseif ('timer:start' === $hook) { |
|
74 | + } |
|
75 | + elseif ('timer:start' === $hook) { |
|
75 | 76 | $name = func_num_args() > 1 ? func_get_arg(1) : 'Timer'; |
76 | 77 | $this->app->profiler->start($name); |
77 | - } elseif ('timer:stop' === $hook) { |
|
78 | + } |
|
79 | + elseif ('timer:stop' === $hook) { |
|
78 | 80 | $this->app->profiler->stop(); |
79 | 81 | } |
80 | 82 | } |