Passed
Push — master ( b281b4...67e49f )
by Paul
02:57
created
plugin/Modules/Hooks.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -4,150 +4,150 @@
 block discarded – undo
4 4
 
5 5
 class Hooks extends Module
6 6
 {
7
-    /**
8
-     * @var array
9
-     */
10
-    protected $hooks = [];
11
-    /**
12
-     * @var int
13
-     */
14
-    protected $totalHooks = 0;
15
-    /**
16
-     * Total elapsed time in nanoseconds.
17
-     * @var int
18
-     */
19
-    protected $totalTime = 0;
7
+	/**
8
+	 * @var array
9
+	 */
10
+	protected $hooks = [];
11
+	/**
12
+	 * @var int
13
+	 */
14
+	protected $totalHooks = 0;
15
+	/**
16
+	 * Total elapsed time in nanoseconds.
17
+	 * @var int
18
+	 */
19
+	protected $totalTime = 0;
20 20
 
21
-    public function entries(): array
22
-    {
23
-        if (!$this->hasEntries()) {
24
-            return [];
25
-        }
26
-        if (!empty($this->hooks)) {
27
-            return $this->hooks;
28
-        }
29
-        array_walk($this->entries, function (&$data) {
30
-            $total = $this->totalTimeForHook($data);
31
-            $perCall = (int) round($total / $data['count']);
32
-            $data['per_call'] = $this->formatTime($perCall);
33
-            $data['total'] = $total;
34
-            $data['total_formatted'] = $this->formatTime($total);
35
-        });
36
-        $entries = $this->entries;
37
-        $executionOrder = array_keys($entries);
38
-        uasort($entries, [$this, 'sortByTime']);
39
-        $this->hooks = array_slice($entries, 0, 50); // Keep the 50 slowest hooks
40
-        $this->totalHooks = array_sum(wp_list_pluck($this->entries, 'count'));
41
-        $this->totalTime = array_sum(wp_list_pluck($this->entries, 'total'));
42
-        $order = array_intersect($executionOrder, array_keys($this->hooks));
43
-        foreach ($order as $index => $hook) {
44
-            $this->hooks[$hook]['index'] = $index;
45
-        }
46
-        return $this->hooks;
47
-    }
21
+	public function entries(): array
22
+	{
23
+		if (!$this->hasEntries()) {
24
+			return [];
25
+		}
26
+		if (!empty($this->hooks)) {
27
+			return $this->hooks;
28
+		}
29
+		array_walk($this->entries, function (&$data) {
30
+			$total = $this->totalTimeForHook($data);
31
+			$perCall = (int) round($total / $data['count']);
32
+			$data['per_call'] = $this->formatTime($perCall);
33
+			$data['total'] = $total;
34
+			$data['total_formatted'] = $this->formatTime($total);
35
+		});
36
+		$entries = $this->entries;
37
+		$executionOrder = array_keys($entries);
38
+		uasort($entries, [$this, 'sortByTime']);
39
+		$this->hooks = array_slice($entries, 0, 50); // Keep the 50 slowest hooks
40
+		$this->totalHooks = array_sum(wp_list_pluck($this->entries, 'count'));
41
+		$this->totalTime = array_sum(wp_list_pluck($this->entries, 'total'));
42
+		$order = array_intersect($executionOrder, array_keys($this->hooks));
43
+		foreach ($order as $index => $hook) {
44
+			$this->hooks[$hook]['index'] = $index;
45
+		}
46
+		return $this->hooks;
47
+	}
48 48
 
49
-    public function info(): string
50
-    {
51
-        $this->entries(); // calculate the totalTime
52
-        return $this->formatTime($this->totalTime);
53
-    }
49
+	public function info(): string
50
+	{
51
+		$this->entries(); // calculate the totalTime
52
+		return $this->formatTime($this->totalTime);
53
+	}
54 54
 
55
-    public function label(): string
56
-    {
57
-        return __('Hooks', 'blackbar');
58
-    }
55
+	public function label(): string
56
+	{
57
+		return __('Hooks', 'blackbar');
58
+	}
59 59
 
60
-    public function startTimer(): void
61
-    {
62
-        if (class_exists('Debug_Bar_Slow_Actions')) {
63
-            return;
64
-        }
65
-        $hook = current_filter();
66
-        if (!isset($this->entries[$hook])) {
67
-            $callbacks = $this->callbacksForHook($hook);
68
-            if (empty($callbacks)) {
69
-                return; // We skipped Blackbar callbacks
70
-            }
71
-            $this->entries[$hook] = [
72
-                'callbacks' => $callbacks,
73
-                'callbacks_count' => count(array_merge(...$callbacks)),
74
-                'count' => 0,
75
-                'stack' => [],
76
-                'time' => [],
77
-            ];
78
-            add_action($hook, [$this, 'stopTimer'], 9999); // @phpstan-ignore-line
79
-        }
80
-        ++$this->entries[$hook]['count'];
81
-        array_push($this->entries[$hook]['stack'], ['start' => (int) hrtime(true)]);
82
-    }
60
+	public function startTimer(): void
61
+	{
62
+		if (class_exists('Debug_Bar_Slow_Actions')) {
63
+			return;
64
+		}
65
+		$hook = current_filter();
66
+		if (!isset($this->entries[$hook])) {
67
+			$callbacks = $this->callbacksForHook($hook);
68
+			if (empty($callbacks)) {
69
+				return; // We skipped Blackbar callbacks
70
+			}
71
+			$this->entries[$hook] = [
72
+				'callbacks' => $callbacks,
73
+				'callbacks_count' => count(array_merge(...$callbacks)),
74
+				'count' => 0,
75
+				'stack' => [],
76
+				'time' => [],
77
+			];
78
+			add_action($hook, [$this, 'stopTimer'], 9999); // @phpstan-ignore-line
79
+		}
80
+		++$this->entries[$hook]['count'];
81
+		array_push($this->entries[$hook]['stack'], ['start' => (int) hrtime(true)]);
82
+	}
83 83
 
84
-    /**
85
-     * @param mixed $filteredValue
86
-     * @return mixed
87
-     */
88
-    public function stopTimer($filteredValue = null)
89
-    {
90
-        $time = array_pop($this->entries[current_filter()]['stack']);
91
-        $time['stop'] = (int) hrtime(true);
92
-        array_push($this->entries[current_filter()]['time'], $time);
93
-        return $filteredValue; // In case this was a filter.
94
-    }
84
+	/**
85
+	 * @param mixed $filteredValue
86
+	 * @return mixed
87
+	 */
88
+	public function stopTimer($filteredValue = null)
89
+	{
90
+		$time = array_pop($this->entries[current_filter()]['stack']);
91
+		$time['stop'] = (int) hrtime(true);
92
+		array_push($this->entries[current_filter()]['time'], $time);
93
+		return $filteredValue; // In case this was a filter.
94
+	}
95 95
 
96
-    /**
97
-     * @param mixed $function
98
-     */
99
-    protected function callbackFunction($function): string
100
-    {
101
-        if (is_array($function)) {
102
-            list($object, $method) = $function;
103
-            if (is_object($object)) {
104
-                $object = get_class($object);
105
-            }
106
-            if (str_starts_with($object, 'GeminiLabs\BlackBar')) {
107
-                return ''; // skip Blackbar callbacks
108
-            }
109
-            return rtrim(sprintf('%s::%s', $object, $method), ':');
110
-        }
111
-        if (is_object($function)) {
112
-            return get_class($function);
113
-        }
114
-        return (string) $function;
115
-    }
96
+	/**
97
+	 * @param mixed $function
98
+	 */
99
+	protected function callbackFunction($function): string
100
+	{
101
+		if (is_array($function)) {
102
+			list($object, $method) = $function;
103
+			if (is_object($object)) {
104
+				$object = get_class($object);
105
+			}
106
+			if (str_starts_with($object, 'GeminiLabs\BlackBar')) {
107
+				return ''; // skip Blackbar callbacks
108
+			}
109
+			return rtrim(sprintf('%s::%s', $object, $method), ':');
110
+		}
111
+		if (is_object($function)) {
112
+			return get_class($function);
113
+		}
114
+		return (string) $function;
115
+	}
116 116
 
117
-    protected function callbacksForHook(string $hook): array
118
-    {
119
-        global $wp_filter;
120
-        $data = $wp_filter[$hook] ?? [];
121
-        $results = [];
122
-        foreach ($data as $priority => $callbacks) {
123
-            $results[$priority] = $results[$priority] ?? [];
124
-            foreach ($callbacks as $callback) {
125
-                $function = $this->callbackFunction($callback['function']);
126
-                if (!empty($function)) {
127
-                    $results[$priority][] = $function;
128
-                }
129
-            }
130
-        }
131
-        return $results;
132
-    }
117
+	protected function callbacksForHook(string $hook): array
118
+	{
119
+		global $wp_filter;
120
+		$data = $wp_filter[$hook] ?? [];
121
+		$results = [];
122
+		foreach ($data as $priority => $callbacks) {
123
+			$results[$priority] = $results[$priority] ?? [];
124
+			foreach ($callbacks as $callback) {
125
+				$function = $this->callbackFunction($callback['function']);
126
+				if (!empty($function)) {
127
+					$results[$priority][] = $function;
128
+				}
129
+			}
130
+		}
131
+		return $results;
132
+	}
133 133
 
134
-    protected function sortByTime(array $a, array $b): int
135
-    {
136
-        if ($a['total'] !== $b['total']) {
137
-            return ($a['total'] > $b['total']) ? -1 : 1;
138
-        }
139
-        return 0;
140
-    }
134
+	protected function sortByTime(array $a, array $b): int
135
+	{
136
+		if ($a['total'] !== $b['total']) {
137
+			return ($a['total'] > $b['total']) ? -1 : 1;
138
+		}
139
+		return 0;
140
+	}
141 141
 
142
-    /**
143
-     * Total elapsed time in nanoseconds.
144
-     */
145
-    protected function totalTimeForHook(array $data): int
146
-    {
147
-        $total = 0;
148
-        foreach ($data['time'] as $time) {
149
-            $total += ($time['stop'] - $time['start']);
150
-        }
151
-        return $total;
152
-    }
142
+	/**
143
+	 * Total elapsed time in nanoseconds.
144
+	 */
145
+	protected function totalTimeForHook(array $data): int
146
+	{
147
+		$total = 0;
148
+		foreach ($data['time'] as $time) {
149
+			$total += ($time['stop'] - $time['start']);
150
+		}
151
+		return $total;
152
+	}
153 153
 }
Please login to merge, or discard this patch.
plugin/Modules/Queries.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -4,74 +4,74 @@
 block discarded – undo
4 4
 
5 5
 class Queries extends Module
6 6
 {
7
-    public function entries(): array
8
-    {
9
-        global $wpdb;
10
-        $entries = [];
11
-        $index = 0;
12
-        $search = [
13
-            'FROM', 'GROUP BY', 'INNER JOIN', 'LEFT JOIN', 'LIMIT',
14
-            'ON DUPLICATE KEY UPDATE', 'ORDER BY', 'OFFSET', ' SET', 'WHERE',
15
-        ];
16
-        $replace = array_map(function ($value) {
17
-            return PHP_EOL.$value;
18
-        }, $search);
19
-        foreach ($wpdb->queries as $query) {
20
-            $sql = preg_replace('/\s\s+/', ' ', trim($query[0]));
21
-            $sql = str_replace(PHP_EOL, ' ', $sql);
22
-            $sql = str_replace(['( ', ' )', ' ,'], ['(', ')', ','], $sql);
23
-            $sql = str_replace($search, $replace, $sql);
24
-            $parts = explode(PHP_EOL, $sql);
25
-            $sql = array_reduce($parts, function ($carry, $part) {
26
-                if (str_starts_with($part, 'SELECT') && strlen($part) > 100) {
27
-                    $part = preg_replace('/\s*(,)\s*/', ','.PHP_EOL.'  ', $part);
28
-                }
29
-                if (str_starts_with($part, 'WHERE')) {
30
-                    $part = str_replace('AND', PHP_EOL.'  AND', $part);
31
-                }
32
-                return $carry.$part.PHP_EOL;
33
-            });
34
-            $trace = explode(', ', $query[2]);
35
-            $nanoseconds = (int) round($query[1] * 1e9);
36
-            $entries[] = [
37
-                'index' => $index++,
38
-                'sql' => $sql,
39
-                'time' => $nanoseconds,
40
-                'time_formatted' => $this->formatTime($nanoseconds),
41
-                'trace' => array_reverse($trace, true),
42
-            ];
43
-        }
44
-        uasort($entries, [$this, 'sortByTime']);
45
-        return $entries;
46
-    }
7
+	public function entries(): array
8
+	{
9
+		global $wpdb;
10
+		$entries = [];
11
+		$index = 0;
12
+		$search = [
13
+			'FROM', 'GROUP BY', 'INNER JOIN', 'LEFT JOIN', 'LIMIT',
14
+			'ON DUPLICATE KEY UPDATE', 'ORDER BY', 'OFFSET', ' SET', 'WHERE',
15
+		];
16
+		$replace = array_map(function ($value) {
17
+			return PHP_EOL.$value;
18
+		}, $search);
19
+		foreach ($wpdb->queries as $query) {
20
+			$sql = preg_replace('/\s\s+/', ' ', trim($query[0]));
21
+			$sql = str_replace(PHP_EOL, ' ', $sql);
22
+			$sql = str_replace(['( ', ' )', ' ,'], ['(', ')', ','], $sql);
23
+			$sql = str_replace($search, $replace, $sql);
24
+			$parts = explode(PHP_EOL, $sql);
25
+			$sql = array_reduce($parts, function ($carry, $part) {
26
+				if (str_starts_with($part, 'SELECT') && strlen($part) > 100) {
27
+					$part = preg_replace('/\s*(,)\s*/', ','.PHP_EOL.'  ', $part);
28
+				}
29
+				if (str_starts_with($part, 'WHERE')) {
30
+					$part = str_replace('AND', PHP_EOL.'  AND', $part);
31
+				}
32
+				return $carry.$part.PHP_EOL;
33
+			});
34
+			$trace = explode(', ', $query[2]);
35
+			$nanoseconds = (int) round($query[1] * 1e9);
36
+			$entries[] = [
37
+				'index' => $index++,
38
+				'sql' => $sql,
39
+				'time' => $nanoseconds,
40
+				'time_formatted' => $this->formatTime($nanoseconds),
41
+				'trace' => array_reverse($trace, true),
42
+			];
43
+		}
44
+		uasort($entries, [$this, 'sortByTime']);
45
+		return $entries;
46
+	}
47 47
 
48
-    public function hasEntries(): bool
49
-    {
50
-        global $wpdb;
51
-        return !empty($wpdb->queries);
52
-    }
48
+	public function hasEntries(): bool
49
+	{
50
+		global $wpdb;
51
+		return !empty($wpdb->queries);
52
+	}
53 53
 
54
-    public function info(): string
55
-    {
56
-        if (!defined('SAVEQUERIES') || !SAVEQUERIES) {
57
-            return '';
58
-        }
59
-        global $wpdb;
60
-        $seconds = (float) array_sum(wp_list_pluck($wpdb->queries, 1));
61
-        $nanoseconds = (int) round($seconds * 1e9);
62
-        return $this->formatTime($nanoseconds);
63
-    }
54
+	public function info(): string
55
+	{
56
+		if (!defined('SAVEQUERIES') || !SAVEQUERIES) {
57
+			return '';
58
+		}
59
+		global $wpdb;
60
+		$seconds = (float) array_sum(wp_list_pluck($wpdb->queries, 1));
61
+		$nanoseconds = (int) round($seconds * 1e9);
62
+		return $this->formatTime($nanoseconds);
63
+	}
64 64
 
65
-    public function label(): string
66
-    {
67
-        return __('SQL', 'blackbar');
68
-    }
65
+	public function label(): string
66
+	{
67
+		return __('SQL', 'blackbar');
68
+	}
69 69
 
70
-    protected function sortByTime(array $a, array $b): int
71
-    {
72
-        if ($a['time'] !== $b['time']) {
73
-            return ($a['time'] > $b['time']) ? -1 : 1;
74
-        }
75
-        return 0;
76
-    }
70
+	protected function sortByTime(array $a, array $b): int
71
+	{
72
+		if ($a['time'] !== $b['time']) {
73
+			return ($a['time'] > $b['time']) ? -1 : 1;
74
+		}
75
+		return 0;
76
+	}
77 77
 }
Please login to merge, or discard this patch.
plugin/Modules/Console.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -6,112 +6,112 @@
 block discarded – undo
6 6
 
7 7
 class Console extends Module
8 8
 {
9
-    public const ERROR_CODES = [
10
-        E_ERROR => 'error', // 1
11
-        E_WARNING => 'warning', // 2
12
-        E_NOTICE => 'notice', // 8
13
-        E_STRICT => 'strict', // 2048
14
-        E_DEPRECATED => 'deprecated', // 8192
15
-    ];
9
+	public const ERROR_CODES = [
10
+		E_ERROR => 'error', // 1
11
+		E_WARNING => 'warning', // 2
12
+		E_NOTICE => 'notice', // 8
13
+		E_STRICT => 'strict', // 2048
14
+		E_DEPRECATED => 'deprecated', // 8192
15
+	];
16 16
 
17
-    public const MAPPED_ERROR_CODES = [
18
-        'debug' => 0,
19
-        'info' => E_NOTICE,
20
-        'deprecated' => E_DEPRECATED, // 8192
21
-        'error' => E_ERROR, // 1
22
-        'notice' => E_NOTICE, // 8
23
-        'strict' => E_STRICT, // 2048
24
-        'warning' => E_WARNING, // 2
25
-        'critical' => E_ERROR, // 1
26
-        'alert' => E_ERROR, // 1
27
-        'emergency' => E_ERROR, // 1
28
-    ];
17
+	public const MAPPED_ERROR_CODES = [
18
+		'debug' => 0,
19
+		'info' => E_NOTICE,
20
+		'deprecated' => E_DEPRECATED, // 8192
21
+		'error' => E_ERROR, // 1
22
+		'notice' => E_NOTICE, // 8
23
+		'strict' => E_STRICT, // 2048
24
+		'warning' => E_WARNING, // 2
25
+		'critical' => E_ERROR, // 1
26
+		'alert' => E_ERROR, // 1
27
+		'emergency' => E_ERROR, // 1
28
+	];
29 29
 
30
-    public function classes(): string
31
-    {
32
-        $errno = array_unique(wp_list_pluck($this->entries, 'errno'));
33
-        if (in_array(E_ERROR, $errno)) {
34
-            return sprintf('%s glbb-error', $this->id());
35
-        }
36
-        if (in_array(E_WARNING, $errno)) {
37
-            return sprintf('%s glbb-warning', $this->id());
38
-        }
39
-        return $this->id();
40
-    }
30
+	public function classes(): string
31
+	{
32
+		$errno = array_unique(wp_list_pluck($this->entries, 'errno'));
33
+		if (in_array(E_ERROR, $errno)) {
34
+			return sprintf('%s glbb-error', $this->id());
35
+		}
36
+		if (in_array(E_WARNING, $errno)) {
37
+			return sprintf('%s glbb-warning', $this->id());
38
+		}
39
+		return $this->id();
40
+	}
41 41
 
42
-    public function entries(): array
43
-    {
44
-        $entries = [];
45
-        foreach ($this->entries as $entry) {
46
-            $entry['name'] = ucfirst($entry['errname']);
47
-            if ($entry['count'] > 1) {
48
-                $entry['name'] = sprintf('%s (%s)', $entry['name'], $entry['count']);
49
-            }
50
-            $entries[] = $entry;
51
-        }
52
-        return $entries;
53
-    }
42
+	public function entries(): array
43
+	{
44
+		$entries = [];
45
+		foreach ($this->entries as $entry) {
46
+			$entry['name'] = ucfirst($entry['errname']);
47
+			if ($entry['count'] > 1) {
48
+				$entry['name'] = sprintf('%s (%s)', $entry['name'], $entry['count']);
49
+			}
50
+			$entries[] = $entry;
51
+		}
52
+		return $entries;
53
+	}
54 54
 
55
-    public function info(): string
56
-    {
57
-        $counts = array_count_values(wp_list_pluck($this->entries, 'errno'));
58
-        $entryCount = count($this->entries);
59
-        if (!empty($counts[E_ERROR])) {
60
-            return sprintf('%d, %d!', $entryCount, $counts[E_ERROR]);
61
-        }
62
-        if ($entryCount > 0) {
63
-            return (string) $entryCount;
64
-        }
65
-        return '';
66
-    }
55
+	public function info(): string
56
+	{
57
+		$counts = array_count_values(wp_list_pluck($this->entries, 'errno'));
58
+		$entryCount = count($this->entries);
59
+		if (!empty($counts[E_ERROR])) {
60
+			return sprintf('%d, %d!', $entryCount, $counts[E_ERROR]);
61
+		}
62
+		if ($entryCount > 0) {
63
+			return (string) $entryCount;
64
+		}
65
+		return '';
66
+	}
67 67
 
68
-    public function label(): string
69
-    {
70
-        return __('Console', 'blackbar');
71
-    }
68
+	public function label(): string
69
+	{
70
+		return __('Console', 'blackbar');
71
+	}
72 72
 
73
-    public function store(string $message, string $errno = '', string $location = ''): void
74
-    {
75
-        if (is_numeric($errno)) { // entry likely stored by set_error_handler()
76
-            $errname = 'Unknown';
77
-            if (array_key_exists((int) $errno, static::ERROR_CODES)) {
78
-                $errname = static::ERROR_CODES[$errno];
79
-            }
80
-        } else { // entry likely stored by filter hook
81
-            $errname = 'Debug';
82
-            if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) {
83
-                $errname = $errno;
84
-                $errno = static::MAPPED_ERROR_CODES[$errno];
85
-            }
86
-        }
87
-        $errname = strtolower($errname);
88
-        $hash = md5($errno.$errname.$message.$location);
89
-        if (array_key_exists($hash, $this->entries)) {
90
-            ++$this->entries[$hash]['count'];
91
-        } else {
92
-            $this->entries[$hash] = [
93
-                'count' => 0,
94
-                'errname' => $errname,
95
-                'errno' => (int) $errno,
96
-                'message' => $this->normalizeMessage($message, $location),
97
-            ];
98
-        }
99
-    }
73
+	public function store(string $message, string $errno = '', string $location = ''): void
74
+	{
75
+		if (is_numeric($errno)) { // entry likely stored by set_error_handler()
76
+			$errname = 'Unknown';
77
+			if (array_key_exists((int) $errno, static::ERROR_CODES)) {
78
+				$errname = static::ERROR_CODES[$errno];
79
+			}
80
+		} else { // entry likely stored by filter hook
81
+			$errname = 'Debug';
82
+			if (array_key_exists($errno, static::MAPPED_ERROR_CODES)) {
83
+				$errname = $errno;
84
+				$errno = static::MAPPED_ERROR_CODES[$errno];
85
+			}
86
+		}
87
+		$errname = strtolower($errname);
88
+		$hash = md5($errno.$errname.$message.$location);
89
+		if (array_key_exists($hash, $this->entries)) {
90
+			++$this->entries[$hash]['count'];
91
+		} else {
92
+			$this->entries[$hash] = [
93
+				'count' => 0,
94
+				'errname' => $errname,
95
+				'errno' => (int) $errno,
96
+				'message' => $this->normalizeMessage($message, $location),
97
+			];
98
+		}
99
+	}
100 100
 
101
-    protected function normalizeMessage($message, string $location): string
102
-    {
103
-        if ($message instanceof \DateTime) {
104
-            $message = $message->format('Y-m-d H:i:s');
105
-        } elseif (is_object($message) || is_array($message)) {
106
-            $message = (new Dump())->dump($message);
107
-        } else {
108
-            $message = esc_html(trim((string) $message));
109
-        }
110
-        $location = trim($location);
111
-        if (!empty($location)) {
112
-            $location = str_replace([WP_CONTENT_DIR, ABSPATH], '', $location);
113
-            $location = sprintf('[%s]', $location);
114
-        }
115
-        return trim(sprintf('%s %s', $location, $message));
116
-    }
101
+	protected function normalizeMessage($message, string $location): string
102
+	{
103
+		if ($message instanceof \DateTime) {
104
+			$message = $message->format('Y-m-d H:i:s');
105
+		} elseif (is_object($message) || is_array($message)) {
106
+			$message = (new Dump())->dump($message);
107
+		} else {
108
+			$message = esc_html(trim((string) $message));
109
+		}
110
+		$location = trim($location);
111
+		if (!empty($location)) {
112
+			$location = str_replace([WP_CONTENT_DIR, ABSPATH], '', $location);
113
+			$location = sprintf('[%s]', $location);
114
+		}
115
+		return trim(sprintf('%s %s', $location, $message));
116
+	}
117 117
 }
Please login to merge, or discard this patch.
autoload.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,20 +3,20 @@
 block discarded – undo
3 3
 defined('WPINC') || exit;
4 4
 
5 5
 spl_autoload_register(function ($className) {
6
-    $namespaces = [
7
-        'GeminiLabs\\BlackBar\\' => __DIR__.'/plugin/',
8
-        'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/',
9
-    ];
10
-    foreach ($namespaces as $prefix => $baseDir) {
11
-        $len = strlen($prefix);
12
-        if (0 !== strncmp($prefix, $className, $len)) {
13
-            continue;
14
-        }
15
-        $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php';
16
-        if (!file_exists($file)) {
17
-            continue;
18
-        }
19
-        require $file;
20
-        break;
21
-    }
6
+	$namespaces = [
7
+		'GeminiLabs\\BlackBar\\' => __DIR__.'/plugin/',
8
+		'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/',
9
+	];
10
+	foreach ($namespaces as $prefix => $baseDir) {
11
+		$len = strlen($prefix);
12
+		if (0 !== strncmp($prefix, $className, $len)) {
13
+			continue;
14
+		}
15
+		$file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php';
16
+		if (!file_exists($file)) {
17
+			continue;
18
+		}
19
+		require $file;
20
+		break;
21
+	}
22 22
 });
Please login to merge, or discard this patch.