Passed
Pull Request — master (#8)
by
unknown
10:23 queued 07:53
created
views/panels/console.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,13 @@
 block discarded – undo
6 6
 		<tr>
7 7
 			<td><?= __('No entries found.', 'blackbar'); ?></td>
8 8
 		</tr>
9
-		<?php else : ?>
9
+		<?php else {
10
+	: ?>
10 11
 		<?php foreach ($entries as $entry) : ?>
11 12
 		<tr>
12
-			<td class="glbb-small"><?= $entry['name']; ?></td>
13
+			<td class="glbb-small"><?= $entry['name'];
14
+}
15
+?></td>
13 16
 			<td><pre><?= $entry['message']; ?></pre></td>
14 17
 		</tr>
15 18
 		<?php endforeach; ?>
Please login to merge, or discard this patch.
views/panels/actions.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,14 +6,17 @@
 block discarded – undo
6 6
 		<tr>
7 7
 			<td><?= __('No entries found.', 'blackbar'); ?></td>
8 8
 		</tr>
9
-		<?php else : ?>
9
+		<?php else {
10
+	: ?>
10 11
 		<?php foreach ($actions->getMeasure() as $hook => $flow) : ?>
11 12
 		<tr>
12 13
 			<td class="glbb-smalls"><?php 
13 14
 			// glsr_log($flow); 
14 15
 			?></td>
15 16
 		</tr>
16
-		<?php endforeach; ?>
17
+		<?php endforeach;
18
+}
19
+?>
17 20
 		<?php endif; ?>
18 21
 	</tbody>
19 22
 </table>
Please login to merge, or discard this patch.
views/panels/queries.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,12 @@
 block discarded – undo
8 8
 		</tr>
9 9
 	</tbody>
10 10
 </table>
11
-<?php else : ?>
11
+<?php else {
12
+	: ?>
12 13
 <form method="get" class="glbb-queries-filter">
13
-	<input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __('Find queries containing', 'blackbar'); ?>">
14
+	<input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __('Find queries containing', 'blackbar');
15
+}
16
+?>">
14 17
 	<input type="text" name="glbb_query_min_time" id="glbb_query_min_time" placeholder="<?= __('Minimum Execution Time', 'blackbar'); ?>">
15 18
 </form>
16 19
 <table class="glbb-queries-table">
Please login to merge, or discard this patch.
views/panels/profiler.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,13 @@
 block discarded – undo
6 6
 		<tr>
7 7
 			<td><?= __('No entries found.', 'blackbar'); ?></td>
8 8
 		</tr>
9
-		<?php else : ?>
9
+		<?php else {
10
+	: ?>
10 11
 		<?php foreach ($profiler->getMeasure() as $timer) : ?>
11 12
 		<tr>
12
-			<td><?= $profiler->getNameString($timer); ?></td>
13
+			<td><?= $profiler->getNameString($timer);
14
+}
15
+?></td>
13 16
 			<td class="glbb-medium"><?= $profiler->getTimeString($timer); ?></td>
14 17
 			<td class="glbb-medium"><?= $profiler->getMemoryString($timer); ?></td>
15 18
 		</tr>
Please login to merge, or discard this patch.
autoload.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
  * PSR-4 autoloader
7 7
  */
8 8
 spl_autoload_register(function ($class) {
9
-    $namespaces = [
10
-        'GeminiLabs\\BlackBar\\' => __DIR__.'/src/',
11
-        'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/',
12
-    ];
13
-    foreach ($namespaces as $prefix => $base_dir) {
14
-        $len = strlen($prefix);
15
-        if (0 !== strncmp($prefix, $class, $len)) {
16
-            continue;
17
-        }
18
-        $file = $base_dir.str_replace('\\', '/', substr($class, $len)).'.php';
19
-        if (!file_exists($file)) {
20
-            continue;
21
-        }
22
-        require $file;
23
-        break;
24
-    }
9
+	$namespaces = [
10
+		'GeminiLabs\\BlackBar\\' => __DIR__.'/src/',
11
+		'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/',
12
+	];
13
+	foreach ($namespaces as $prefix => $base_dir) {
14
+		$len = strlen($prefix);
15
+		if (0 !== strncmp($prefix, $class, $len)) {
16
+			continue;
17
+		}
18
+		$file = $base_dir.str_replace('\\', '/', substr($class, $len)).'.php';
19
+		if (!file_exists($file)) {
20
+			continue;
21
+		}
22
+		require $file;
23
+		break;
24
+	}
25 25
 });
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@
 block discarded – undo
5 5
 /*
6 6
  * PSR-4 autoloader
7 7
  */
8
-spl_autoload_register(function ($class) {
8
+spl_autoload_register(function ($class)
9
+{
9 10
     $namespaces = [
10 11
         'GeminiLabs\\BlackBar\\' => __DIR__.'/src/',
11 12
         'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/',
Please login to merge, or discard this patch.
compatibility.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * @see https://docs.gravityforms.com/gform_noconflict_scripts/
8 8
  */
9 9
 add_filter('gform_noconflict_scripts', function (array $scripts) {
10
-    $scripts[] = 'blackbar';
11
-    return $scripts;
10
+	$scripts[] = 'blackbar';
11
+	return $scripts;
12 12
 });
13 13
 
14 14
 /*
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @see https://docs.gravityforms.com/gform_noconflict_styles/
17 17
  */
18 18
 add_filter('gform_noconflict_styles', function (array $styles) {
19
-    $styles[] = 'blackbar';
20
-    $styles[] = 'blackbar-syntax';
21
-    return $styles;
19
+	$styles[] = 'blackbar';
20
+	$styles[] = 'blackbar-syntax';
21
+	return $styles;
22 22
 });
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@  discard block
 block discarded – undo
6 6
  * @return array
7 7
  * @see https://docs.gravityforms.com/gform_noconflict_scripts/
8 8
  */
9
-add_filter('gform_noconflict_scripts', function (array $scripts) {
9
+add_filter('gform_noconflict_scripts', function (array $scripts)
10
+{
10 11
     $scripts[] = 'blackbar';
11 12
     return $scripts;
12 13
 });
@@ -15,7 +16,8 @@  discard block
 block discarded – undo
15 16
  * @return array
16 17
  * @see https://docs.gravityforms.com/gform_noconflict_styles/
17 18
  */
18
-add_filter('gform_noconflict_styles', function (array $styles) {
19
+add_filter('gform_noconflict_styles', function (array $styles)
20
+{
19 21
     $styles[] = 'blackbar';
20 22
     $styles[] = 'blackbar-syntax';
21 23
     return $styles;
Please login to merge, or discard this patch.
src/Application.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -4,106 +4,106 @@
 block discarded – undo
4 4
 
5 5
 final class Application
6 6
 {
7
-    const CONSOLE_HOOK = 'console';
8
-    const ID = 'blackbar';
9
-    const LANG = '/languages/';
10
-    const PROFILER_HOOK = 'profile';
7
+	const CONSOLE_HOOK = 'console';
8
+	const ID = 'blackbar';
9
+	const LANG = '/languages/';
10
+	const PROFILER_HOOK = 'profile';
11 11
 
12
-    public $actions;
13
-    public $console;
14
-    public $errors = array();
15
-    public $file;
16
-    public $profiler;
12
+	public $actions;
13
+	public $console;
14
+	public $errors = array();
15
+	public $file;
16
+	public $profiler;
17 17
 
18
-    public function __construct()
19
-    {
20
-        $this->actions = new SlowActions();
21
-        $this->console = new Console();
22
-        $this->file = realpath(dirname(__DIR__).'/'.static::ID.'.php');
23
-        $this->profiler = new Profiler();
24
-    }
18
+	public function __construct()
19
+	{
20
+		$this->actions = new SlowActions();
21
+		$this->console = new Console();
22
+		$this->file = realpath(dirname(__DIR__).'/'.static::ID.'.php');
23
+		$this->profiler = new Profiler();
24
+	}
25 25
 
26
-    /**
27
-     * @param int $errno
28
-     * @param string $errstr
29
-     * @param string $errfile
30
-     * @param int $errline
31
-     * @return void
32
-     */
33
-    public function errorHandler($errno, $errstr, $errfile, $errline)
34
-    {
35
-        $errname = array_key_exists($errno, Console::ERROR_CODES)
36
-            ? Console::ERROR_CODES[$errno]
37
-            : 'Unknown';
38
-        $hash = md5($errno.$errstr.$errfile.$errline);
39
-        if (array_key_exists($hash, $this->errors)) {
40
-            ++$this->errors[$hash]['count'];
41
-        } else {
42
-            $this->errors[$hash] = array(
43
-                'errno' => $errno,
44
-                'message' => $errstr,
45
-                'file' => $errfile,
46
-                'name' => $errname,
47
-                'line' => $errline,
48
-                'count' => 0,
49
-            );
50
-        }
51
-    }
26
+	/**
27
+	 * @param int $errno
28
+	 * @param string $errstr
29
+	 * @param string $errfile
30
+	 * @param int $errline
31
+	 * @return void
32
+	 */
33
+	public function errorHandler($errno, $errstr, $errfile, $errline)
34
+	{
35
+		$errname = array_key_exists($errno, Console::ERROR_CODES)
36
+			? Console::ERROR_CODES[$errno]
37
+			: 'Unknown';
38
+		$hash = md5($errno.$errstr.$errfile.$errline);
39
+		if (array_key_exists($hash, $this->errors)) {
40
+			++$this->errors[$hash]['count'];
41
+		} else {
42
+			$this->errors[$hash] = array(
43
+				'errno' => $errno,
44
+				'message' => $errstr,
45
+				'file' => $errfile,
46
+				'name' => $errname,
47
+				'line' => $errline,
48
+				'count' => 0,
49
+			);
50
+		}
51
+	}
52 52
 
53
-    /**
54
-     * @return void
55
-     */
56
-    public function init()
57
-    {
58
-        $controller = new Controller($this);
59
-        add_filter('all', array($controller, 'initConsole'));
60
-        add_filter('all', array($controller, 'initProfiler'));
61
-        add_filter('all', array($controller, 'measureSlowActions'));
62
-        add_action('plugins_loaded', array($controller, 'registerLanguages'));
63
-        add_action('init', function () use ($controller) {
64
-            if (!apply_filters('blackbar/enabled', true)) {
65
-                return;
66
-            }
67
-            add_action('admin_enqueue_scripts', array($controller, 'enqueueAssets'));
68
-            add_action('wp_enqueue_scripts', array($controller, 'enqueueAssets'));
69
-            add_action('admin_footer', array($controller, 'renderBar'));
70
-            add_action('wp_footer', array($controller, 'renderBar'));
71
-            add_filter('admin_body_class', array($controller, 'filterBodyClasses'));
72
-        });
73
-        apply_filters('debug', 'Profiler Started');
74
-        apply_filters('debug', 'blackbar/profiler/noise');
75
-        set_error_handler(array($this, 'errorHandler'), E_ALL | E_STRICT);
76
-    }
53
+	/**
54
+	 * @return void
55
+	 */
56
+	public function init()
57
+	{
58
+		$controller = new Controller($this);
59
+		add_filter('all', array($controller, 'initConsole'));
60
+		add_filter('all', array($controller, 'initProfiler'));
61
+		add_filter('all', array($controller, 'measureSlowActions'));
62
+		add_action('plugins_loaded', array($controller, 'registerLanguages'));
63
+		add_action('init', function () use ($controller) {
64
+			if (!apply_filters('blackbar/enabled', true)) {
65
+				return;
66
+			}
67
+			add_action('admin_enqueue_scripts', array($controller, 'enqueueAssets'));
68
+			add_action('wp_enqueue_scripts', array($controller, 'enqueueAssets'));
69
+			add_action('admin_footer', array($controller, 'renderBar'));
70
+			add_action('wp_footer', array($controller, 'renderBar'));
71
+			add_filter('admin_body_class', array($controller, 'filterBodyClasses'));
72
+		});
73
+		apply_filters('debug', 'Profiler Started');
74
+		apply_filters('debug', 'blackbar/profiler/noise');
75
+		set_error_handler(array($this, 'errorHandler'), E_ALL | E_STRICT);
76
+	}
77 77
 
78
-    /**
79
-     * @param string $file
80
-     * @return string
81
-     */
82
-    public function path($file = '')
83
-    {
84
-        return plugin_dir_path($this->file).ltrim(trim($file), '/');
85
-    }
78
+	/**
79
+	 * @param string $file
80
+	 * @return string
81
+	 */
82
+	public function path($file = '')
83
+	{
84
+		return plugin_dir_path($this->file).ltrim(trim($file), '/');
85
+	}
86 86
 
87
-    /**
88
-     * @param string $view
89
-     * @return void
90
-     */
91
-    public function render($view, array $data = array())
92
-    {
93
-        $file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
94
-        if (!file_exists($file)) {
95
-            return;
96
-        }
97
-        extract($data);
98
-        include $file;
99
-    }
87
+	/**
88
+	 * @param string $view
89
+	 * @return void
90
+	 */
91
+	public function render($view, array $data = array())
92
+	{
93
+		$file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
94
+		if (!file_exists($file)) {
95
+			return;
96
+		}
97
+		extract($data);
98
+		include $file;
99
+	}
100 100
 
101
-    /**
102
-     * @param string $path
103
-     * @return string
104
-     */
105
-    public function url($path = '')
106
-    {
107
-        return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
108
-    }
101
+	/**
102
+	 * @param string $path
103
+	 * @return string
104
+	 */
105
+	public function url($path = '')
106
+	{
107
+		return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
108
+	}
109 109
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@  discard block
 block discarded – undo
38 38
         $hash = md5($errno.$errstr.$errfile.$errline);
39 39
         if (array_key_exists($hash, $this->errors)) {
40 40
             ++$this->errors[$hash]['count'];
41
-        } else {
41
+        }
42
+        else {
42 43
             $this->errors[$hash] = array(
43 44
                 'errno' => $errno,
44 45
                 'message' => $errstr,
@@ -60,7 +61,8 @@  discard block
 block discarded – undo
60 61
         add_filter('all', array($controller, 'initProfiler'));
61 62
         add_filter('all', array($controller, 'measureSlowActions'));
62 63
         add_action('plugins_loaded', array($controller, 'registerLanguages'));
63
-        add_action('init', function () use ($controller) {
64
+        add_action('init', function () use ($controller)
65
+        {
64 66
             if (!apply_filters('blackbar/enabled', true)) {
65 67
                 return;
66 68
             }
Please login to merge, or discard this patch.
src/Profiler.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -4,109 +4,109 @@
 block discarded – undo
4 4
 
5 5
 class Profiler
6 6
 {
7
-    /**
8
-     * This is the time that WordPress takes to execute the profiler hook.
9
-     * @var int
10
-     */
11
-    protected $noise = 0;
7
+	/**
8
+	 * This is the time that WordPress takes to execute the profiler hook.
9
+	 * @var int
10
+	 */
11
+	protected $noise = 0;
12 12
 
13
-    /**
14
-     * @var int
15
-     */
16
-    protected $start = null;
13
+	/**
14
+	 * @var int
15
+	 */
16
+	protected $start = null;
17 17
 
18
-    /**
19
-     * @var int
20
-     */
21
-    protected $stop = null;
18
+	/**
19
+	 * @var int
20
+	 */
21
+	protected $stop = null;
22 22
 
23
-    /**
24
-     * @var array
25
-     */
26
-    protected $timers = array();
23
+	/**
24
+	 * @var array
25
+	 */
26
+	protected $timers = array();
27 27
 
28
-    /**
29
-     * @return array
30
-     */
31
-    public function getMeasure()
32
-    {
33
-        return $this->timers;
34
-    }
28
+	/**
29
+	 * @return array
30
+	 */
31
+	public function getMeasure()
32
+	{
33
+		return $this->timers;
34
+	}
35 35
 
36
-    /**
37
-     * @param array $timer
38
-     * @return string
39
-     */
40
-    public function getMemoryString($timer)
41
-    {
42
-        $timer = $this->normalize($timer);
43
-        return sprintf('%s kB', round($timer['memory'] / 1000));
44
-    }
36
+	/**
37
+	 * @param array $timer
38
+	 * @return string
39
+	 */
40
+	public function getMemoryString($timer)
41
+	{
42
+		$timer = $this->normalize($timer);
43
+		return sprintf('%s kB', round($timer['memory'] / 1000));
44
+	}
45 45
 
46
-    /**
47
-     * @param array $timer
48
-     * @return string
49
-     */
50
-    public function getNameString($timer)
51
-    {
52
-        $timer = $this->normalize($timer);
53
-        return $timer['name'];
54
-    }
46
+	/**
47
+	 * @param array $timer
48
+	 * @return string
49
+	 */
50
+	public function getNameString($timer)
51
+	{
52
+		$timer = $this->normalize($timer);
53
+		return $timer['name'];
54
+	}
55 55
 
56
-    /**
57
-     * @param array $timer
58
-     * @return string
59
-     */
60
-    public function getTimeString($timer)
61
-    {
62
-        $timer = $this->normalize($timer);
63
-        $index = array_search($timer['name'], array_column($this->timers, 'name'));
64
-        $start = $this->start + ($index * $this->noise);
65
-        $time = number_format(round(($timer['time'] - $start) * 1000, 4), 4);
66
-        return sprintf('%s ms', $time);
67
-    }
56
+	/**
57
+	 * @param array $timer
58
+	 * @return string
59
+	 */
60
+	public function getTimeString($timer)
61
+	{
62
+		$timer = $this->normalize($timer);
63
+		$index = array_search($timer['name'], array_column($this->timers, 'name'));
64
+		$start = $this->start + ($index * $this->noise);
65
+		$time = number_format(round(($timer['time'] - $start) * 1000, 4), 4);
66
+		return sprintf('%s ms', $time);
67
+	}
68 68
 
69
-    /**
70
-     * @return int Microseconds
71
-     */
72
-    public function getTotalTime()
73
-    {
74
-        $totalNoise = (count($this->timers) - 1) * $this->noise;
75
-        return $this->stop - $this->start - $totalNoise;
76
-    }
69
+	/**
70
+	 * @return int Microseconds
71
+	 */
72
+	public function getTotalTime()
73
+	{
74
+		$totalNoise = (count($this->timers) - 1) * $this->noise;
75
+		return $this->stop - $this->start - $totalNoise;
76
+	}
77 77
 
78
-    /**
79
-     * @param string $name
80
-     * @return void
81
-     */
82
-    public function trace($name)
83
-    {
84
-        $microtime = microtime(true);
85
-        if (!$this->start) {
86
-            $this->start = $microtime;
87
-        }
88
-        if ('blackbar/profiler/noise' === $name) {
89
-            $this->noise = $microtime - $this->start;
90
-            return;
91
-        }
92
-        $this->timers[] = array(
93
-            'memory' => memory_get_peak_usage(),
94
-            'name' => $name,
95
-            'time' => $microtime,
96
-        );
97
-        $this->stop = $microtime;
98
-    }
78
+	/**
79
+	 * @param string $name
80
+	 * @return void
81
+	 */
82
+	public function trace($name)
83
+	{
84
+		$microtime = microtime(true);
85
+		if (!$this->start) {
86
+			$this->start = $microtime;
87
+		}
88
+		if ('blackbar/profiler/noise' === $name) {
89
+			$this->noise = $microtime - $this->start;
90
+			return;
91
+		}
92
+		$this->timers[] = array(
93
+			'memory' => memory_get_peak_usage(),
94
+			'name' => $name,
95
+			'time' => $microtime,
96
+		);
97
+		$this->stop = $microtime;
98
+	}
99 99
 
100
-    /**
101
-     * @param array $timer
102
-     * @return array
103
-     */
104
-    protected function normalize($timer)
105
-    {
106
-        return wp_parse_args((array) $timer, array(
107
-            'memory' => 0,
108
-            'name' => '',
109
-            'time' => 0,
110
-        ));
111
-    }
100
+	/**
101
+	 * @param array $timer
102
+	 * @return array
103
+	 */
104
+	protected function normalize($timer)
105
+	{
106
+		return wp_parse_args((array) $timer, array(
107
+			'memory' => 0,
108
+			'name' => '',
109
+			'time' => 0,
110
+		));
111
+	}
112 112
 }
Please login to merge, or discard this patch.
src/Controller.php 2 patches
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -4,289 +4,289 @@
 block discarded – undo
4 4
 
5 5
 class Controller
6 6
 {
7
-    /**
8
-     * @var Application
9
-     */
10
-    protected $app;
7
+	/**
8
+	 * @var Application
9
+	 */
10
+	protected $app;
11 11
 
12
-    public function __construct(Application $app)
13
-    {
14
-        $this->app = $app;
15
-    }
12
+	public function __construct(Application $app)
13
+	{
14
+		$this->app = $app;
15
+	}
16 16
 
17
-    /**
18
-     * @return void
19
-     * @action admin_enqueue_scripts
20
-     * @action wp_enqueue_scripts
21
-     */
22
-    public function enqueueAssets()
23
-    {
24
-        wp_enqueue_script(Application::ID, $this->app->url('assets/main.js'));
25
-        wp_enqueue_style(Application::ID, $this->app->url('assets/main.css'), array('dashicons'));
26
-        wp_enqueue_style(Application::ID.'-syntax', $this->app->url('assets/syntax.css'));
27
-    }
17
+	/**
18
+	 * @return void
19
+	 * @action admin_enqueue_scripts
20
+	 * @action wp_enqueue_scripts
21
+	 */
22
+	public function enqueueAssets()
23
+	{
24
+		wp_enqueue_script(Application::ID, $this->app->url('assets/main.js'));
25
+		wp_enqueue_style(Application::ID, $this->app->url('assets/main.css'), array('dashicons'));
26
+		wp_enqueue_style(Application::ID.'-syntax', $this->app->url('assets/syntax.css'));
27
+	}
28 28
 
29
-    /**
30
-     * @param string $classes
31
-     * @return string
32
-     * @action admin_body_class
33
-     */
34
-    public function filterBodyClasses($classes)
35
-    {
36
-        return trim($classes.' '.Application::ID);
37
-    }
29
+	/**
30
+	 * @param string $classes
31
+	 * @return string
32
+	 * @action admin_body_class
33
+	 */
34
+	public function filterBodyClasses($classes)
35
+	{
36
+		return trim($classes.' '.Application::ID);
37
+	}
38 38
 
39
-    /**
40
-     * @return void
41
-     * @filter all
42
-     */
43
-    public function initConsole()
44
-    {
45
-        if (Application::CONSOLE_HOOK != func_get_arg(0)) {
46
-            return;
47
-        }
48
-        $args = array_pad(func_get_args(), 4, '');
49
-        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
50
-        $entry = array_pop($backtrace);
51
-        $location = $args[3];
52
-        if (empty(trim($location)) && array_key_exists('file', $entry)) {
53
-            $path = explode(ABSPATH, $entry['file']);
54
-            $location = sprintf('%s:%s', array_pop($path), $entry['line']);
55
-        }
56
-        $this->app->console->store($args[1], $args[2], '['.$location.'] ');
57
-    }
39
+	/**
40
+	 * @return void
41
+	 * @filter all
42
+	 */
43
+	public function initConsole()
44
+	{
45
+		if (Application::CONSOLE_HOOK != func_get_arg(0)) {
46
+			return;
47
+		}
48
+		$args = array_pad(func_get_args(), 4, '');
49
+		$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
50
+		$entry = array_pop($backtrace);
51
+		$location = $args[3];
52
+		if (empty(trim($location)) && array_key_exists('file', $entry)) {
53
+			$path = explode(ABSPATH, $entry['file']);
54
+			$location = sprintf('%s:%s', array_pop($path), $entry['line']);
55
+		}
56
+		$this->app->console->store($args[1], $args[2], '['.$location.'] ');
57
+	}
58 58
 
59
-    /**
60
-     * @return void
61
-     * @filter all
62
-     */
63
-    public function initProfiler()
64
-    {
65
-        if (Application::PROFILER_HOOK != func_get_arg(0)) {
66
-            return;
67
-        }
68
-        $this->app->profiler->trace(func_get_arg(1));
69
-    }
59
+	/**
60
+	 * @return void
61
+	 * @filter all
62
+	 */
63
+	public function initProfiler()
64
+	{
65
+		if (Application::PROFILER_HOOK != func_get_arg(0)) {
66
+			return;
67
+		}
68
+		$this->app->profiler->trace(func_get_arg(1));
69
+	}
70 70
 
71
-    /**
72
-     * @return void
73
-     * @filter all
74
-     */
75
-    public function measureSlowActions()
76
-    {
77
-        $this->app->actions->startTimer();
78
-    }
71
+	/**
72
+	 * @return void
73
+	 * @filter all
74
+	 */
75
+	public function measureSlowActions()
76
+	{
77
+		$this->app->actions->startTimer();
78
+	}
79 79
 
80
-    /**
81
-     * @return void
82
-     * @action plugins_loaded
83
-     */
84
-    public function registerLanguages()
85
-    {
86
-        load_plugin_textdomain(Application::ID, false,
87
-            plugin_basename($this->app->path()).Application::LANG
88
-        );
89
-    }
80
+	/**
81
+	 * @return void
82
+	 * @action plugins_loaded
83
+	 */
84
+	public function registerLanguages()
85
+	{
86
+		load_plugin_textdomain(Application::ID, false,
87
+			plugin_basename($this->app->path()).Application::LANG
88
+		);
89
+	}
90 90
 
91
-    /**
92
-     * @return void
93
-     * @action admin_footer
94
-     * @action wp_footer
95
-     */
96
-    public function renderBar()
97
-    {
98
-        apply_filters('debug', 'Profiler Stopped');
99
-        $this->app->render('debug-bar', array(
100
-            'blackbar' => $this->app,
101
-            'actions' => $this->app->actions,
102
-            'actionsLabel' => $this->getSlowActionsLabel(),
103
-            'consoleEntries' => $this->getConsoleEntries(),
104
-            'consoleLabel' => $this->getConsoleLabel(),
105
-            'profiler' => $this->app->profiler,
106
-            'profilerLabel' => $this->getProfilerLabel(),
107
-            'queries' => $this->getQueries(),
108
-            'queriesLabel' => $this->getQueriesLabel(),
109
-            'templates' => $this->getTemplates(),
110
-        ));
111
-    }
91
+	/**
92
+	 * @return void
93
+	 * @action admin_footer
94
+	 * @action wp_footer
95
+	 */
96
+	public function renderBar()
97
+	{
98
+		apply_filters('debug', 'Profiler Stopped');
99
+		$this->app->render('debug-bar', array(
100
+			'blackbar' => $this->app,
101
+			'actions' => $this->app->actions,
102
+			'actionsLabel' => $this->getSlowActionsLabel(),
103
+			'consoleEntries' => $this->getConsoleEntries(),
104
+			'consoleLabel' => $this->getConsoleLabel(),
105
+			'profiler' => $this->app->profiler,
106
+			'profilerLabel' => $this->getProfilerLabel(),
107
+			'queries' => $this->getQueries(),
108
+			'queriesLabel' => $this->getQueriesLabel(),
109
+			'templates' => $this->getTemplates(),
110
+		));
111
+	}
112 112
 
113
-    /**
114
-     * @param int $time
115
-     * @param int $decimals
116
-     * @return string
117
-     */
118
-    protected function convertToMiliseconds($time, $decimals = 2)
119
-    {
120
-        return number_format($time * 1000, $decimals);
121
-    }
113
+	/**
114
+	 * @param int $time
115
+	 * @param int $decimals
116
+	 * @return string
117
+	 */
118
+	protected function convertToMiliseconds($time, $decimals = 2)
119
+	{
120
+		return number_format($time * 1000, $decimals);
121
+	}
122 122
 
123
-    /**
124
-     * @return array
125
-     */
126
-    protected function getConsoleEntries()
127
-    {
128
-        return array_merge($this->getErrors(), $this->app->console->entries);
129
-    }
123
+	/**
124
+	 * @return array
125
+	 */
126
+	protected function getConsoleEntries()
127
+	{
128
+		return array_merge($this->getErrors(), $this->app->console->entries);
129
+	}
130 130
 
131
-    /**
132
-     * @return string
133
-     */
134
-    protected function getConsoleLabel()
135
-    {
136
-        $class = '';
137
-        $entries = $this->getConsoleEntries();
138
-        $entryCount = count($entries);
139
-        $errorCount = 0;
140
-        $label = __('Console', 'blackbar');
141
-        foreach ($entries as $entry) {
142
-            if (in_array($entry['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED])) {
143
-                $class = 'glbb-warning';
144
-            }
145
-            if (in_array($entry['errno'], [E_WARNING])) {
146
-                ++$errorCount;
147
-            }
148
-        }
149
-        if ($entryCount > 0) {
150
-            $label .= sprintf(' (%d)', $entryCount);
151
-        }
152
-        if ($errorCount > 0) {
153
-            $class = 'glbb-error';
154
-            $label .= sprintf(' (%d, %d!)', $entryCount, $errorCount);
155
-        }
156
-        return '<span class="'.$class.'">'.$label.'</span>';
157
-    }
131
+	/**
132
+	 * @return string
133
+	 */
134
+	protected function getConsoleLabel()
135
+	{
136
+		$class = '';
137
+		$entries = $this->getConsoleEntries();
138
+		$entryCount = count($entries);
139
+		$errorCount = 0;
140
+		$label = __('Console', 'blackbar');
141
+		foreach ($entries as $entry) {
142
+			if (in_array($entry['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED])) {
143
+				$class = 'glbb-warning';
144
+			}
145
+			if (in_array($entry['errno'], [E_WARNING])) {
146
+				++$errorCount;
147
+			}
148
+		}
149
+		if ($entryCount > 0) {
150
+			$label .= sprintf(' (%d)', $entryCount);
151
+		}
152
+		if ($errorCount > 0) {
153
+			$class = 'glbb-error';
154
+			$label .= sprintf(' (%d, %d!)', $entryCount, $errorCount);
155
+		}
156
+		return '<span class="'.$class.'">'.$label.'</span>';
157
+	}
158 158
 
159
-    /**
160
-     * @return array
161
-     */
162
-    protected function getErrors()
163
-    {
164
-        $errors = array();
165
-        foreach ($this->app->errors as $error) {
166
-            $class = 'glbb-info';
167
-            if (in_array($error['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED])) {
168
-                $class = 'glbb-warning';
169
-            }
170
-            if (E_WARNING == $error['errno']) {
171
-                $class = 'glbb-error';
172
-            }
173
-            if ($error['count'] > 1) {
174
-                $error['name'] .= ' ('.$error['count'].')';
175
-            }
176
-            $errors[] = array(
177
-                'errno' => $error['errno'],
178
-                'name' => '<span class="'.$class.'">'.$error['name'].'</span>',
179
-                'message' => sprintf(__('%s on line %s in file %s', 'blackbar'),
180
-                    $error['message'],
181
-                    $error['line'],
182
-                    $error['file']
183
-                ),
184
-            );
185
-        }
186
-        return $errors;
187
-    }
159
+	/**
160
+	 * @return array
161
+	 */
162
+	protected function getErrors()
163
+	{
164
+		$errors = array();
165
+		foreach ($this->app->errors as $error) {
166
+			$class = 'glbb-info';
167
+			if (in_array($error['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED])) {
168
+				$class = 'glbb-warning';
169
+			}
170
+			if (E_WARNING == $error['errno']) {
171
+				$class = 'glbb-error';
172
+			}
173
+			if ($error['count'] > 1) {
174
+				$error['name'] .= ' ('.$error['count'].')';
175
+			}
176
+			$errors[] = array(
177
+				'errno' => $error['errno'],
178
+				'name' => '<span class="'.$class.'">'.$error['name'].'</span>',
179
+				'message' => sprintf(__('%s on line %s in file %s', 'blackbar'),
180
+					$error['message'],
181
+					$error['line'],
182
+					$error['file']
183
+				),
184
+			);
185
+		}
186
+		return $errors;
187
+	}
188 188
 
189
-    /**
190
-     * @return array
191
-     */
192
-    protected function getIncludedFiles()
193
-    {
194
-        $files = array_values(array_filter(get_included_files(), function ($file) {
195
-            $bool = false !== strpos($file, '/themes/')
196
-                && false === strpos($file, '/functions.php');
197
-            return (bool) apply_filters('blackbar/templates/file', $bool, $file);
198
-        }));
199
-        return array_map(function ($key, $value) {
200
-            $value = str_replace(trailingslashit(WP_CONTENT_DIR), '', $value);
201
-            return sprintf('[%s] => %s', $key, $value);
202
-        }, array_keys($files), $files);
203
-    }
189
+	/**
190
+	 * @return array
191
+	 */
192
+	protected function getIncludedFiles()
193
+	{
194
+		$files = array_values(array_filter(get_included_files(), function ($file) {
195
+			$bool = false !== strpos($file, '/themes/')
196
+				&& false === strpos($file, '/functions.php');
197
+			return (bool) apply_filters('blackbar/templates/file', $bool, $file);
198
+		}));
199
+		return array_map(function ($key, $value) {
200
+			$value = str_replace(trailingslashit(WP_CONTENT_DIR), '', $value);
201
+			return sprintf('[%s] => %s', $key, $value);
202
+		}, array_keys($files), $files);
203
+	}
204 204
 
205
-    /**
206
-     * @return string
207
-     */
208
-    protected function getProfilerLabel()
209
-    {
210
-        $label = __('Profiler', 'blackbar');
211
-        $profilerTime = $this->convertToMiliseconds($this->app->profiler->getTotalTime(), 0);
212
-        if ($profilerTime > 0) {
213
-            $label .= sprintf(' (%s %s)', $profilerTime, __('ms', 'blackbar'));
214
-        }
215
-        return $label;
216
-    }
205
+	/**
206
+	 * @return string
207
+	 */
208
+	protected function getProfilerLabel()
209
+	{
210
+		$label = __('Profiler', 'blackbar');
211
+		$profilerTime = $this->convertToMiliseconds($this->app->profiler->getTotalTime(), 0);
212
+		if ($profilerTime > 0) {
213
+			$label .= sprintf(' (%s %s)', $profilerTime, __('ms', 'blackbar'));
214
+		}
215
+		return $label;
216
+	}
217 217
 
218
-    /**
219
-     * @return array
220
-     */
221
-    protected function getQueries()
222
-    {
223
-        global $wpdb;
224
-        $queries = array();
225
-        $search = array(
226
-            'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LIMIT', 'ON DUPLICATE KEY UPDATE',
227
-            'ORDER BY', 'SET', 'WHERE',
228
-        );
229
-        $replace = array_map(function ($value) {
230
-            return PHP_EOL.$value;
231
-        }, $search);
232
-        foreach ($wpdb->queries as $query) {
233
-            $miliseconds = number_format(round($query[1] * 1000, 4), 4);
234
-            $sql = preg_replace('/\s\s+/', ' ', trim($query[0]));
235
-            $sql = str_replace(PHP_EOL, ' ', $sql);
236
-            $sql = str_replace($search, $replace, $sql);
237
-            $queries[] = array(
238
-                'ms' => $miliseconds,
239
-                'sql' => $sql,
240
-            );
241
-        }
242
-        return $queries;
243
-    }
218
+	/**
219
+	 * @return array
220
+	 */
221
+	protected function getQueries()
222
+	{
223
+		global $wpdb;
224
+		$queries = array();
225
+		$search = array(
226
+			'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LIMIT', 'ON DUPLICATE KEY UPDATE',
227
+			'ORDER BY', 'SET', 'WHERE',
228
+		);
229
+		$replace = array_map(function ($value) {
230
+			return PHP_EOL.$value;
231
+		}, $search);
232
+		foreach ($wpdb->queries as $query) {
233
+			$miliseconds = number_format(round($query[1] * 1000, 4), 4);
234
+			$sql = preg_replace('/\s\s+/', ' ', trim($query[0]));
235
+			$sql = str_replace(PHP_EOL, ' ', $sql);
236
+			$sql = str_replace($search, $replace, $sql);
237
+			$queries[] = array(
238
+				'ms' => $miliseconds,
239
+				'sql' => $sql,
240
+			);
241
+		}
242
+		return $queries;
243
+	}
244 244
 
245
-    /**
246
-     * @return string
247
-     */
248
-    protected function getQueriesLabel()
249
-    {
250
-        $label = __('SQL', 'blackbar');
251
-        if (!SAVEQUERIES) {
252
-            return $label;
253
-        }
254
-        global $wpdb;
255
-        $queryTime = 0;
256
-        foreach ($wpdb->queries as $query) {
257
-            $queryTime += $query[1];
258
-        }
259
-        $queriesCount = '<span class="glbb-queries-count">'.count($wpdb->queries).'</span>';
260
-        $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds($queryTime).'</span>';
261
-        return $label.sprintf(' (%s %s | %s %s)', $queriesCount, __('queries', 'blackbar'), $queriesTime, __('ms', 'blackbar'));
262
-    }
245
+	/**
246
+	 * @return string
247
+	 */
248
+	protected function getQueriesLabel()
249
+	{
250
+		$label = __('SQL', 'blackbar');
251
+		if (!SAVEQUERIES) {
252
+			return $label;
253
+		}
254
+		global $wpdb;
255
+		$queryTime = 0;
256
+		foreach ($wpdb->queries as $query) {
257
+			$queryTime += $query[1];
258
+		}
259
+		$queriesCount = '<span class="glbb-queries-count">'.count($wpdb->queries).'</span>';
260
+		$queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds($queryTime).'</span>';
261
+		return $label.sprintf(' (%s %s | %s %s)', $queriesCount, __('queries', 'blackbar'), $queriesTime, __('ms', 'blackbar'));
262
+	}
263 263
 
264
-    /**
265
-     * @return string
266
-     */
267
-    protected function getSlowActionsLabel()
268
-    {
269
-        $label = __('Hooks', 'blackbar');
270
-        $totalTime = $this->convertToMiliseconds($this->app->actions->getTotalTime(), 0);
271
-        if ($totalTime > 0) {
272
-            $label .= sprintf(' (%s %s)', $totalTime, __('ms', 'blackbar'));
273
-        }
274
-        return $label;
275
-    }
264
+	/**
265
+	 * @return string
266
+	 */
267
+	protected function getSlowActionsLabel()
268
+	{
269
+		$label = __('Hooks', 'blackbar');
270
+		$totalTime = $this->convertToMiliseconds($this->app->actions->getTotalTime(), 0);
271
+		if ($totalTime > 0) {
272
+			$label .= sprintf(' (%s %s)', $totalTime, __('ms', 'blackbar'));
273
+		}
274
+		return $label;
275
+	}
276 276
 
277
-    /**
278
-     * @return void|string
279
-     */
280
-    protected function getTemplates()
281
-    {
282
-        if (is_admin()) {
283
-            return;
284
-        }
285
-        if (class_exists('\GeminiLabs\Castor\Facades\Development')) {
286
-            ob_start();
287
-            \GeminiLabs\Castor\Facades\Development::printTemplatePaths();
288
-            return ob_get_clean();
289
-        }
290
-        return '<pre>'.implode(PHP_EOL, $this->getIncludedFiles()).'</pre>';
291
-    }
277
+	/**
278
+	 * @return void|string
279
+	 */
280
+	protected function getTemplates()
281
+	{
282
+		if (is_admin()) {
283
+			return;
284
+		}
285
+		if (class_exists('\GeminiLabs\Castor\Facades\Development')) {
286
+			ob_start();
287
+			\GeminiLabs\Castor\Facades\Development::printTemplatePaths();
288
+			return ob_get_clean();
289
+		}
290
+		return '<pre>'.implode(PHP_EOL, $this->getIncludedFiles()).'</pre>';
291
+	}
292 292
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -191,12 +191,14 @@  discard block
 block discarded – undo
191 191
      */
192 192
     protected function getIncludedFiles()
193 193
     {
194
-        $files = array_values(array_filter(get_included_files(), function ($file) {
194
+        $files = array_values(array_filter(get_included_files(), function ($file)
195
+        {
195 196
             $bool = false !== strpos($file, '/themes/')
196 197
                 && false === strpos($file, '/functions.php');
197 198
             return (bool) apply_filters('blackbar/templates/file', $bool, $file);
198 199
         }));
199
-        return array_map(function ($key, $value) {
200
+        return array_map(function ($key, $value)
201
+        {
200 202
             $value = str_replace(trailingslashit(WP_CONTENT_DIR), '', $value);
201 203
             return sprintf('[%s] => %s', $key, $value);
202 204
         }, array_keys($files), $files);
@@ -226,7 +228,8 @@  discard block
 block discarded – undo
226 228
             'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LIMIT', 'ON DUPLICATE KEY UPDATE',
227 229
             'ORDER BY', 'SET', 'WHERE',
228 230
         );
229
-        $replace = array_map(function ($value) {
231
+        $replace = array_map(function ($value)
232
+        {
230 233
             return PHP_EOL.$value;
231 234
         }, $search);
232 235
         foreach ($wpdb->queries as $query) {
Please login to merge, or discard this patch.