Cancelled
Push — master ( 706ba7...b281b4 )
by Paul
02:38
created
plugin/Dump.php 2 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -7,142 +7,142 @@
 block discarded – undo
7 7
  */
8 8
 class Dump
9 9
 {
10
-    public $depth;
11
-    public $ignore;
10
+	public $depth;
11
+	public $ignore;
12 12
 
13
-    protected $level = 0;
14
-    protected $result = [];
15
-    protected $stack = [];
13
+	protected $level = 0;
14
+	protected $result = [];
15
+	protected $stack = [];
16 16
 
17
-    /**
18
-     * @param mixed $value
19
-     */
20
-    public function dump($value, int $depth = 3, array $ignore = []): string
21
-    {
22
-        $this->depth = $depth;
23
-        $this->ignore = $ignore;
24
-        $this->reset();
25
-        $this->inspect($value);
26
-        $result = implode('', $this->result);
27
-        $result = rtrim($result, "\n");
28
-        $this->reset();
29
-        return $result;
30
-    }
17
+	/**
18
+	 * @param mixed $value
19
+	 */
20
+	public function dump($value, int $depth = 3, array $ignore = []): string
21
+	{
22
+		$this->depth = $depth;
23
+		$this->ignore = $ignore;
24
+		$this->reset();
25
+		$this->inspect($value);
26
+		$result = implode('', $this->result);
27
+		$result = rtrim($result, "\n");
28
+		$this->reset();
29
+		return $result;
30
+	}
31 31
 
32
-    protected function formatKey(string $key): string
33
-    {
34
-        $result = [];
35
-        $result[] = str_repeat(' ', $this->level * 4).'[';
36
-        if (is_string($key) && "\0" === $key[0]) {
37
-            $keyParts = explode("\0", $key);
38
-            $result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private');
39
-        } else {
40
-            $result[] = $key;
41
-        }
42
-        $result[] = '] => ';
43
-        return implode('', $result);
44
-    }
32
+	protected function formatKey(string $key): string
33
+	{
34
+		$result = [];
35
+		$result[] = str_repeat(' ', $this->level * 4).'[';
36
+		if (is_string($key) && "\0" === $key[0]) {
37
+			$keyParts = explode("\0", $key);
38
+			$result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private');
39
+		} else {
40
+			$result[] = $key;
41
+		}
42
+		$result[] = '] => ';
43
+		return implode('', $result);
44
+	}
45 45
 
46
-    /**
47
-     * @param mixed $subject
48
-     */
49
-    protected function inspect($subject): void
50
-    {
51
-        ++$this->level;
52
-        if ($subject instanceof \Closure) {
53
-            $this->inspectClosure($subject);
54
-        } elseif (is_object($subject)) {
55
-            $this->inspectObject($subject);
56
-        } elseif (is_array($subject)) {
57
-            $this->inspectArray($subject);
58
-        } else {
59
-            $this->inspectPrimitive($subject);
60
-        }
61
-        --$this->level;
62
-    }
46
+	/**
47
+	 * @param mixed $subject
48
+	 */
49
+	protected function inspect($subject): void
50
+	{
51
+		++$this->level;
52
+		if ($subject instanceof \Closure) {
53
+			$this->inspectClosure($subject);
54
+		} elseif (is_object($subject)) {
55
+			$this->inspectObject($subject);
56
+		} elseif (is_array($subject)) {
57
+			$this->inspectArray($subject);
58
+		} else {
59
+			$this->inspectPrimitive($subject);
60
+		}
61
+		--$this->level;
62
+	}
63 63
 
64
-    protected function inspectArray(array $subject): void
65
-    {
66
-        if ($this->level > $this->depth) {
67
-            $this->result[] = "Nested Array\n";
68
-            return;
69
-        }
70
-        if (empty($subject)) {
71
-            $this->result[] = "Array ()\n";
72
-            return;
73
-        }
74
-        $this->result[] = "Array (\n";
75
-        foreach ($subject as $key => $val) {
76
-            if (false === $this->isIgnoredKey($key)) {
77
-                $this->result[] = str_repeat(' ', $this->level * 4).'['.$key.'] => ';
78
-                $this->inspect($val);
79
-            }
80
-        }
81
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
82
-    }
64
+	protected function inspectArray(array $subject): void
65
+	{
66
+		if ($this->level > $this->depth) {
67
+			$this->result[] = "Nested Array\n";
68
+			return;
69
+		}
70
+		if (empty($subject)) {
71
+			$this->result[] = "Array ()\n";
72
+			return;
73
+		}
74
+		$this->result[] = "Array (\n";
75
+		foreach ($subject as $key => $val) {
76
+			if (false === $this->isIgnoredKey($key)) {
77
+				$this->result[] = str_repeat(' ', $this->level * 4).'['.$key.'] => ';
78
+				$this->inspect($val);
79
+			}
80
+		}
81
+		$this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
82
+	}
83 83
 
84
-    protected function inspectClosure(\Closure $subject): void
85
-    {
86
-        $reflection = new \ReflectionFunction($subject);
87
-        $params = array_map(function ($param) {
88
-            return ($param->isPassedByReference() ? '&$' : '$').$param->name;
89
-        }, $reflection->getParameters());
90
-        $this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n";
91
-    }
84
+	protected function inspectClosure(\Closure $subject): void
85
+	{
86
+		$reflection = new \ReflectionFunction($subject);
87
+		$params = array_map(function ($param) {
88
+			return ($param->isPassedByReference() ? '&$' : '$').$param->name;
89
+		}, $reflection->getParameters());
90
+		$this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n";
91
+	}
92 92
 
93
-    /**
94
-     * @param object $subject
95
-     */
96
-    protected function inspectObject($subject): void
97
-    {
98
-        $classname = get_class($subject);
99
-        if ($this->level > $this->depth) {
100
-            $this->result[] = 'Nested '.$classname." Object\n";
101
-            return;
102
-        }
103
-        if ($subject instanceof \ArrayObject) {
104
-            $this->result[] = $classname." ArrayObject (\n";
105
-        } else {
106
-            $this->result[] = $classname." Object (\n";
107
-            $subject = (array) $subject;
108
-        }
109
-        foreach ($subject as $key => $val) {
110
-            if (false === $this->isIgnoredKey($key)) {
111
-                $this->result[] = $this->formatKey($key);
112
-                $this->inspect($val);
113
-            }
114
-        }
115
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
116
-    }
93
+	/**
94
+	 * @param object $subject
95
+	 */
96
+	protected function inspectObject($subject): void
97
+	{
98
+		$classname = get_class($subject);
99
+		if ($this->level > $this->depth) {
100
+			$this->result[] = 'Nested '.$classname." Object\n";
101
+			return;
102
+		}
103
+		if ($subject instanceof \ArrayObject) {
104
+			$this->result[] = $classname." ArrayObject (\n";
105
+		} else {
106
+			$this->result[] = $classname." Object (\n";
107
+			$subject = (array) $subject;
108
+		}
109
+		foreach ($subject as $key => $val) {
110
+			if (false === $this->isIgnoredKey($key)) {
111
+				$this->result[] = $this->formatKey($key);
112
+				$this->inspect($val);
113
+			}
114
+		}
115
+		$this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
116
+	}
117 117
 
118
-    /**
119
-     * @param mixed $subject
120
-     */
121
-    protected function inspectPrimitive($subject): void
122
-    {
123
-        if (true === $subject) {
124
-            $subject = '(bool) true';
125
-        } elseif (false === $subject) {
126
-            $subject = '(bool) false';
127
-        } elseif (null === $subject) {
128
-            $subject = '(null)';
129
-        }
130
-        $this->result[] = $subject."\n";
131
-    }
118
+	/**
119
+	 * @param mixed $subject
120
+	 */
121
+	protected function inspectPrimitive($subject): void
122
+	{
123
+		if (true === $subject) {
124
+			$subject = '(bool) true';
125
+		} elseif (false === $subject) {
126
+			$subject = '(bool) false';
127
+		} elseif (null === $subject) {
128
+			$subject = '(null)';
129
+		}
130
+		$this->result[] = $subject."\n";
131
+	}
132 132
 
133
-    /**
134
-     * @param string $key
135
-     */
136
-    protected function isIgnoredKey($key): bool
137
-    {
138
-        return in_array($key, $this->ignore);
139
-    }
133
+	/**
134
+	 * @param string $key
135
+	 */
136
+	protected function isIgnoredKey($key): bool
137
+	{
138
+		return in_array($key, $this->ignore);
139
+	}
140 140
 
141
-    protected function reset(): void
142
-    {
143
-        $this->level = 0;
144
-        $this->result = [];
145
-        $this->stack = [];
146
-    }
141
+	protected function reset(): void
142
+	{
143
+		$this->level = 0;
144
+		$this->result = [];
145
+		$this->stack = [];
146
+	}
147 147
 }
148 148
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,138 +11,138 @@
 block discarded – undo
11 11
     public $ignore;
12 12
 
13 13
     protected $level = 0;
14
-    protected $result = [];
15
-    protected $stack = [];
14
+    protected $result = [ ];
15
+    protected $stack = [ ];
16 16
 
17 17
     /**
18 18
      * @param mixed $value
19 19
      */
20
-    public function dump($value, int $depth = 3, array $ignore = []): string
20
+    public function dump( $value, int $depth = 3, array $ignore = [ ] ): string
21 21
     {
22 22
         $this->depth = $depth;
23 23
         $this->ignore = $ignore;
24 24
         $this->reset();
25
-        $this->inspect($value);
26
-        $result = implode('', $this->result);
27
-        $result = rtrim($result, "\n");
25
+        $this->inspect( $value );
26
+        $result = implode( '', $this->result );
27
+        $result = rtrim( $result, "\n" );
28 28
         $this->reset();
29 29
         return $result;
30 30
     }
31 31
 
32
-    protected function formatKey(string $key): string
32
+    protected function formatKey( string $key ): string
33 33
     {
34
-        $result = [];
35
-        $result[] = str_repeat(' ', $this->level * 4).'[';
36
-        if (is_string($key) && "\0" === $key[0]) {
37
-            $keyParts = explode("\0", $key);
38
-            $result[] = $keyParts[2].(('*' === $keyParts[1]) ? ':protected' : ':private');
34
+        $result = [ ];
35
+        $result[ ] = str_repeat( ' ', $this->level * 4 ) . '[';
36
+        if( is_string( $key ) && "\0" === $key[ 0 ] ) {
37
+            $keyParts = explode( "\0", $key );
38
+            $result[ ] = $keyParts[ 2 ] . ( ( '*' === $keyParts[ 1 ] ) ? ':protected' : ':private' );
39 39
         } else {
40
-            $result[] = $key;
40
+            $result[ ] = $key;
41 41
         }
42
-        $result[] = '] => ';
43
-        return implode('', $result);
42
+        $result[ ] = '] => ';
43
+        return implode( '', $result );
44 44
     }
45 45
 
46 46
     /**
47 47
      * @param mixed $subject
48 48
      */
49
-    protected function inspect($subject): void
49
+    protected function inspect( $subject ): void
50 50
     {
51 51
         ++$this->level;
52
-        if ($subject instanceof \Closure) {
53
-            $this->inspectClosure($subject);
54
-        } elseif (is_object($subject)) {
55
-            $this->inspectObject($subject);
56
-        } elseif (is_array($subject)) {
57
-            $this->inspectArray($subject);
52
+        if( $subject instanceof \Closure ) {
53
+            $this->inspectClosure( $subject );
54
+        } elseif( is_object( $subject ) ) {
55
+            $this->inspectObject( $subject );
56
+        } elseif( is_array( $subject ) ) {
57
+            $this->inspectArray( $subject );
58 58
         } else {
59
-            $this->inspectPrimitive($subject);
59
+            $this->inspectPrimitive( $subject );
60 60
         }
61 61
         --$this->level;
62 62
     }
63 63
 
64
-    protected function inspectArray(array $subject): void
64
+    protected function inspectArray( array $subject ): void
65 65
     {
66
-        if ($this->level > $this->depth) {
67
-            $this->result[] = "Nested Array\n";
66
+        if( $this->level > $this->depth ) {
67
+            $this->result[ ] = "Nested Array\n";
68 68
             return;
69 69
         }
70
-        if (empty($subject)) {
71
-            $this->result[] = "Array ()\n";
70
+        if( empty( $subject ) ) {
71
+            $this->result[ ] = "Array ()\n";
72 72
             return;
73 73
         }
74
-        $this->result[] = "Array (\n";
75
-        foreach ($subject as $key => $val) {
76
-            if (false === $this->isIgnoredKey($key)) {
77
-                $this->result[] = str_repeat(' ', $this->level * 4).'['.$key.'] => ';
78
-                $this->inspect($val);
74
+        $this->result[ ] = "Array (\n";
75
+        foreach( $subject as $key => $val ) {
76
+            if( false === $this->isIgnoredKey( $key ) ) {
77
+                $this->result[ ] = str_repeat( ' ', $this->level * 4 ) . '[' . $key . '] => ';
78
+                $this->inspect( $val );
79 79
             }
80 80
         }
81
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
81
+        $this->result[ ] = str_repeat( ' ', ( $this->level - 1 ) * 4 ) . ")\n";
82 82
     }
83 83
 
84
-    protected function inspectClosure(\Closure $subject): void
84
+    protected function inspectClosure( \Closure $subject ): void
85 85
     {
86
-        $reflection = new \ReflectionFunction($subject);
87
-        $params = array_map(function ($param) {
88
-            return ($param->isPassedByReference() ? '&$' : '$').$param->name;
89
-        }, $reflection->getParameters());
90
-        $this->result[] = 'Closure ('.implode(', ', $params).') { ... }'."\n";
86
+        $reflection = new \ReflectionFunction( $subject );
87
+        $params = array_map( function( $param ) {
88
+            return ( $param->isPassedByReference() ? '&$' : '$' ) . $param->name;
89
+        }, $reflection->getParameters() );
90
+        $this->result[ ] = 'Closure (' . implode( ', ', $params ) . ') { ... }' . "\n";
91 91
     }
92 92
 
93 93
     /**
94 94
      * @param object $subject
95 95
      */
96
-    protected function inspectObject($subject): void
96
+    protected function inspectObject( $subject ): void
97 97
     {
98
-        $classname = get_class($subject);
99
-        if ($this->level > $this->depth) {
100
-            $this->result[] = 'Nested '.$classname." Object\n";
98
+        $classname = get_class( $subject );
99
+        if( $this->level > $this->depth ) {
100
+            $this->result[ ] = 'Nested ' . $classname . " Object\n";
101 101
             return;
102 102
         }
103
-        if ($subject instanceof \ArrayObject) {
104
-            $this->result[] = $classname." ArrayObject (\n";
103
+        if( $subject instanceof \ArrayObject ) {
104
+            $this->result[ ] = $classname . " ArrayObject (\n";
105 105
         } else {
106
-            $this->result[] = $classname." Object (\n";
106
+            $this->result[ ] = $classname . " Object (\n";
107 107
             $subject = (array) $subject;
108 108
         }
109
-        foreach ($subject as $key => $val) {
110
-            if (false === $this->isIgnoredKey($key)) {
111
-                $this->result[] = $this->formatKey($key);
112
-                $this->inspect($val);
109
+        foreach( $subject as $key => $val ) {
110
+            if( false === $this->isIgnoredKey( $key ) ) {
111
+                $this->result[ ] = $this->formatKey( $key );
112
+                $this->inspect( $val );
113 113
             }
114 114
         }
115
-        $this->result[] = str_repeat(' ', ($this->level - 1) * 4).")\n";
115
+        $this->result[ ] = str_repeat( ' ', ( $this->level - 1 ) * 4 ) . ")\n";
116 116
     }
117 117
 
118 118
     /**
119 119
      * @param mixed $subject
120 120
      */
121
-    protected function inspectPrimitive($subject): void
121
+    protected function inspectPrimitive( $subject ): void
122 122
     {
123
-        if (true === $subject) {
123
+        if( true === $subject ) {
124 124
             $subject = '(bool) true';
125
-        } elseif (false === $subject) {
125
+        } elseif( false === $subject ) {
126 126
             $subject = '(bool) false';
127
-        } elseif (null === $subject) {
127
+        } elseif( null === $subject ) {
128 128
             $subject = '(null)';
129 129
         }
130
-        $this->result[] = $subject."\n";
130
+        $this->result[ ] = $subject . "\n";
131 131
     }
132 132
 
133 133
     /**
134 134
      * @param string $key
135 135
      */
136
-    protected function isIgnoredKey($key): bool
136
+    protected function isIgnoredKey( $key ): bool
137 137
     {
138
-        return in_array($key, $this->ignore);
138
+        return in_array( $key, $this->ignore );
139 139
     }
140 140
 
141 141
     protected function reset(): void
142 142
     {
143 143
         $this->level = 0;
144
-        $this->result = [];
145
-        $this->stack = [];
144
+        $this->result = [ ];
145
+        $this->stack = [ ];
146 146
     }
147 147
 }
148 148
 
Please login to merge, or discard this patch.
plugin/Controller.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -4,118 +4,118 @@
 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
-     * @action admin_enqueue_scripts
19
-     * @action wp_enqueue_scripts
20
-     */
21
-    public function enqueueAssets(): void
22
-    {
23
-        wp_enqueue_script(Application::ID, $this->app->url('assets/main.js'));
24
-        wp_enqueue_style(Application::ID, $this->app->url('assets/main.css'), ['dashicons']);
25
-        wp_enqueue_style(Application::ID.'-syntax', $this->app->url('assets/syntax.css'));
26
-    }
17
+	/**
18
+	 * @action admin_enqueue_scripts
19
+	 * @action wp_enqueue_scripts
20
+	 */
21
+	public function enqueueAssets(): void
22
+	{
23
+		wp_enqueue_script(Application::ID, $this->app->url('assets/main.js'));
24
+		wp_enqueue_style(Application::ID, $this->app->url('assets/main.css'), ['dashicons']);
25
+		wp_enqueue_style(Application::ID.'-syntax', $this->app->url('assets/syntax.css'));
26
+	}
27 27
 
28
-    /**
29
-     * @param string $classes
30
-     * @action admin_body_class
31
-     */
32
-    public function filterBodyClasses($classes): string
33
-    {
34
-        return trim((string) $classes.' '.Application::ID);
35
-    }
28
+	/**
29
+	 * @param string $classes
30
+	 * @action admin_body_class
31
+	 */
32
+	public function filterBodyClasses($classes): string
33
+	{
34
+		return trim((string) $classes.' '.Application::ID);
35
+	}
36 36
 
37
-    /**
38
-     * @action all
39
-     */
40
-    public function initConsole(): void
41
-    {
42
-        if (Application::CONSOLE_HOOK !== func_get_arg(0)) {
43
-            return;
44
-        }
45
-        $args = array_pad(func_get_args(), 4, '');
46
-        $args = array_combine(['hook', 'message', 'errno', 'location'], $args);
47
-        $args = array_map('sanitize_textarea_field', $args);
48
-        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
49
-        $entry = array_pop($backtrace); // get the fourth backtrace entry
50
-        if (empty(trim($args['location'])) && array_key_exists('file', $entry)) {
51
-            $path = explode(ABSPATH, $entry['file']);
52
-            $args['location'] = sprintf('%s:%s', array_pop($path), $entry['line']);
53
-        }
54
-        $this->app->console->store($args['message'], $args['errno'], $args['location']);
55
-    }
37
+	/**
38
+	 * @action all
39
+	 */
40
+	public function initConsole(): void
41
+	{
42
+		if (Application::CONSOLE_HOOK !== func_get_arg(0)) {
43
+			return;
44
+		}
45
+		$args = array_pad(func_get_args(), 4, '');
46
+		$args = array_combine(['hook', 'message', 'errno', 'location'], $args);
47
+		$args = array_map('sanitize_textarea_field', $args);
48
+		$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
49
+		$entry = array_pop($backtrace); // get the fourth backtrace entry
50
+		if (empty(trim($args['location'])) && array_key_exists('file', $entry)) {
51
+			$path = explode(ABSPATH, $entry['file']);
52
+			$args['location'] = sprintf('%s:%s', array_pop($path), $entry['line']);
53
+		}
54
+		$this->app->console->store($args['message'], $args['errno'], $args['location']);
55
+	}
56 56
 
57
-    /**
58
-     * @action all
59
-     */
60
-    public function initHooks(): void
61
-    {
62
-        $this->app->hooks->startTimer();
63
-    }
57
+	/**
58
+	 * @action all
59
+	 */
60
+	public function initHooks(): void
61
+	{
62
+		$this->app->hooks->startTimer();
63
+	}
64 64
 
65
-    /**
66
-     * @action all
67
-     */
68
-    public function initProfiler(): void
69
-    {
70
-        $hook = func_get_arg(0);
71
-        if ('blackbar/profiler/start' === $hook) { // time when the profiler started
72
-            $this->app->profiler->setStart((int) hrtime(true));
73
-            return;
74
-        }
75
-        if ('blackbar/profiler/noise' === $hook) { // measure the profiler noise
76
-            $this->app->profiler->setNoise((int) hrtime(true));
77
-            return;
78
-        }
79
-        if ('blackbar/profiler/stop' === $hook) { // time when the profiler stopped
80
-            $this->app->profiler->setStop((int) hrtime(true));
81
-            return;
82
-        }
83
-        if ('timer:start' === $hook) {
84
-            $name = func_num_args() > 1 ? func_get_arg(1) : 'Timer';
85
-            $this->app->profiler->start($name);
86
-            return;
87
-        }
88
-        if ('timer:stop' === $hook) {
89
-            $this->app->profiler->stop();
90
-        }
91
-    }
65
+	/**
66
+	 * @action all
67
+	 */
68
+	public function initProfiler(): void
69
+	{
70
+		$hook = func_get_arg(0);
71
+		if ('blackbar/profiler/start' === $hook) { // time when the profiler started
72
+			$this->app->profiler->setStart((int) hrtime(true));
73
+			return;
74
+		}
75
+		if ('blackbar/profiler/noise' === $hook) { // measure the profiler noise
76
+			$this->app->profiler->setNoise((int) hrtime(true));
77
+			return;
78
+		}
79
+		if ('blackbar/profiler/stop' === $hook) { // time when the profiler stopped
80
+			$this->app->profiler->setStop((int) hrtime(true));
81
+			return;
82
+		}
83
+		if ('timer:start' === $hook) {
84
+			$name = func_num_args() > 1 ? func_get_arg(1) : 'Timer';
85
+			$this->app->profiler->start($name);
86
+			return;
87
+		}
88
+		if ('timer:stop' === $hook) {
89
+			$this->app->profiler->stop();
90
+		}
91
+	}
92 92
 
93
-    /**
94
-     * @action plugins_loaded
95
-     */
96
-    public function registerLanguages(): void
97
-    {
98
-        load_plugin_textdomain(Application::ID, false,
99
-            plugin_basename($this->app->path()).'/languages/'
100
-        );
101
-    }
93
+	/**
94
+	 * @action plugins_loaded
95
+	 */
96
+	public function registerLanguages(): void
97
+	{
98
+		load_plugin_textdomain(Application::ID, false,
99
+			plugin_basename($this->app->path()).'/languages/'
100
+		);
101
+	}
102 102
 
103
-    /**
104
-     * @action admin_footer
105
-     * @action wp_footer
106
-     */
107
-    public function renderBar(): void
108
-    {
109
-        do_action('blackbar/profiler/stop'); // stop profiler
110
-        $this->app->render('debug-bar', [
111
-            'modules' => [ // order is intentional
112
-                $this->app->console,
113
-                $this->app->profiler,
114
-                $this->app->queries,
115
-                $this->app->hooks,
116
-                $this->app->templates,
117
-                $this->app->globals,
118
-            ],
119
-        ]);
120
-    }
103
+	/**
104
+	 * @action admin_footer
105
+	 * @action wp_footer
106
+	 */
107
+	public function renderBar(): void
108
+	{
109
+		do_action('blackbar/profiler/stop'); // stop profiler
110
+		$this->app->render('debug-bar', [
111
+			'modules' => [ // order is intentional
112
+				$this->app->console,
113
+				$this->app->profiler,
114
+				$this->app->queries,
115
+				$this->app->hooks,
116
+				$this->app->templates,
117
+				$this->app->globals,
118
+			],
119
+		]);
120
+	}
121 121
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
      */
10 10
     protected $app;
11 11
 
12
-    public function __construct(Application $app)
12
+    public function __construct( Application $app )
13 13
     {
14 14
         $this->app = $app;
15 15
     }
@@ -20,18 +20,18 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function enqueueAssets(): void
22 22
     {
23
-        wp_enqueue_script(Application::ID, $this->app->url('assets/main.js'));
24
-        wp_enqueue_style(Application::ID, $this->app->url('assets/main.css'), ['dashicons']);
25
-        wp_enqueue_style(Application::ID.'-syntax', $this->app->url('assets/syntax.css'));
23
+        wp_enqueue_script( Application::ID, $this->app->url( 'assets/main.js' ) );
24
+        wp_enqueue_style( Application::ID, $this->app->url( 'assets/main.css' ), [ 'dashicons' ] );
25
+        wp_enqueue_style( Application::ID . '-syntax', $this->app->url( 'assets/syntax.css' ) );
26 26
     }
27 27
 
28 28
     /**
29 29
      * @param string $classes
30 30
      * @action admin_body_class
31 31
      */
32
-    public function filterBodyClasses($classes): string
32
+    public function filterBodyClasses( $classes ): string
33 33
     {
34
-        return trim((string) $classes.' '.Application::ID);
34
+        return trim( (string) $classes . ' ' . Application::ID );
35 35
     }
36 36
 
37 37
     /**
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function initConsole(): void
41 41
     {
42
-        if (Application::CONSOLE_HOOK !== func_get_arg(0)) {
42
+        if( Application::CONSOLE_HOOK !== func_get_arg( 0 ) ) {
43 43
             return;
44 44
         }
45
-        $args = array_pad(func_get_args(), 4, '');
46
-        $args = array_combine(['hook', 'message', 'errno', 'location'], $args);
47
-        $args = array_map('sanitize_textarea_field', $args);
48
-        $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
49
-        $entry = array_pop($backtrace); // get the fourth backtrace entry
50
-        if (empty(trim($args['location'])) && array_key_exists('file', $entry)) {
51
-            $path = explode(ABSPATH, $entry['file']);
52
-            $args['location'] = sprintf('%s:%s', array_pop($path), $entry['line']);
45
+        $args = array_pad( func_get_args(), 4, '' );
46
+        $args = array_combine( [ 'hook', 'message', 'errno', 'location' ], $args );
47
+        $args = array_map( 'sanitize_textarea_field', $args );
48
+        $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
49
+        $entry = array_pop( $backtrace ); // get the fourth backtrace entry
50
+        if( empty( trim( $args[ 'location' ] ) ) && array_key_exists( 'file', $entry ) ) {
51
+            $path = explode( ABSPATH, $entry[ 'file' ] );
52
+            $args[ 'location' ] = sprintf( '%s:%s', array_pop( $path ), $entry[ 'line' ] );
53 53
         }
54
-        $this->app->console->store($args['message'], $args['errno'], $args['location']);
54
+        $this->app->console->store( $args[ 'message' ], $args[ 'errno' ], $args[ 'location' ] );
55 55
     }
56 56
 
57 57
     /**
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function initProfiler(): void
69 69
     {
70
-        $hook = func_get_arg(0);
71
-        if ('blackbar/profiler/start' === $hook) { // time when the profiler started
72
-            $this->app->profiler->setStart((int) hrtime(true));
70
+        $hook = func_get_arg( 0 );
71
+        if( 'blackbar/profiler/start' === $hook ) { // time when the profiler started
72
+            $this->app->profiler->setStart( (int) hrtime( true ) );
73 73
             return;
74 74
         }
75
-        if ('blackbar/profiler/noise' === $hook) { // measure the profiler noise
76
-            $this->app->profiler->setNoise((int) hrtime(true));
75
+        if( 'blackbar/profiler/noise' === $hook ) { // measure the profiler noise
76
+            $this->app->profiler->setNoise( (int) hrtime( true ) );
77 77
             return;
78 78
         }
79
-        if ('blackbar/profiler/stop' === $hook) { // time when the profiler stopped
80
-            $this->app->profiler->setStop((int) hrtime(true));
79
+        if( 'blackbar/profiler/stop' === $hook ) { // time when the profiler stopped
80
+            $this->app->profiler->setStop( (int) hrtime( true ) );
81 81
             return;
82 82
         }
83
-        if ('timer:start' === $hook) {
84
-            $name = func_num_args() > 1 ? func_get_arg(1) : 'Timer';
85
-            $this->app->profiler->start($name);
83
+        if( 'timer:start' === $hook ) {
84
+            $name = func_num_args() > 1 ? func_get_arg( 1 ) : 'Timer';
85
+            $this->app->profiler->start( $name );
86 86
             return;
87 87
         }
88
-        if ('timer:stop' === $hook) {
88
+        if( 'timer:stop' === $hook ) {
89 89
             $this->app->profiler->stop();
90 90
         }
91 91
     }
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function registerLanguages(): void
97 97
     {
98
-        load_plugin_textdomain(Application::ID, false,
99
-            plugin_basename($this->app->path()).'/languages/'
98
+        load_plugin_textdomain( Application::ID, false,
99
+            plugin_basename( $this->app->path() ) . '/languages/'
100 100
         );
101 101
     }
102 102
 
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function renderBar(): void
108 108
     {
109
-        do_action('blackbar/profiler/stop'); // stop profiler
110
-        $this->app->render('debug-bar', [
109
+        do_action( 'blackbar/profiler/stop' ); // stop profiler
110
+        $this->app->render( 'debug-bar', [
111 111
             'modules' => [ // order is intentional
112 112
                 $this->app->console,
113 113
                 $this->app->profiler,
@@ -116,6 +116,6 @@  discard block
 block discarded – undo
116 116
                 $this->app->templates,
117 117
                 $this->app->globals,
118 118
             ],
119
-        ]);
119
+        ] );
120 120
     }
121 121
 }
Please login to merge, or discard this patch.
plugin/Modules/Templates.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 
7 7
 class Templates extends Module
8 8
 {
9
-    public function entries(): array
10
-    {
11
-        if (!empty($this->entries)) {
12
-            return $this->entries;
13
-        }
14
-        if (class_exists('\GeminiLabs\Castor\Facades\Development')
15
-            && class_exists('\GeminiLabs\Castor\Helpers\Development')
16
-            && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line
17
-            $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths();
18
-        } else {
19
-            $files = array_values(array_filter(get_included_files(), function ($file) {
20
-                $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php');
21
-                return (bool) apply_filters('blackbar/templates/file', $bool, $file);
22
-            }));
23
-            $this->entries = array_map(function ($file) {
24
-                return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file);
25
-            }, $files);
26
-        }
27
-        return $this->entries;
28
-    }
9
+	public function entries(): array
10
+	{
11
+		if (!empty($this->entries)) {
12
+			return $this->entries;
13
+		}
14
+		if (class_exists('\GeminiLabs\Castor\Facades\Development')
15
+			&& class_exists('\GeminiLabs\Castor\Helpers\Development')
16
+			&& method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line
17
+			$this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths();
18
+		} else {
19
+			$files = array_values(array_filter(get_included_files(), function ($file) {
20
+				$bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php');
21
+				return (bool) apply_filters('blackbar/templates/file', $bool, $file);
22
+			}));
23
+			$this->entries = array_map(function ($file) {
24
+				return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file);
25
+			}, $files);
26
+		}
27
+		return $this->entries;
28
+	}
29 29
 
30
-    public function hasEntries(): bool
31
-    {
32
-        return !empty($this->entries());
33
-    }
30
+	public function hasEntries(): bool
31
+	{
32
+		return !empty($this->entries());
33
+	}
34 34
 
35
-    public function isVisible(): bool
36
-    {
37
-        return !is_admin() && $this->hasEntries();
38
-    }
35
+	public function isVisible(): bool
36
+	{
37
+		return !is_admin() && $this->hasEntries();
38
+	}
39 39
 
40
-    public function label(): string
41
-    {
42
-        return __('Templates', 'blackbar');
43
-    }
40
+	public function label(): string
41
+	{
42
+		return __('Templates', 'blackbar');
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 {
9 9
     public function entries(): array
10 10
     {
11
-        if (!empty($this->entries)) {
11
+        if( !empty( $this->entries ) ) {
12 12
             return $this->entries;
13 13
         }
14
-        if (class_exists('\GeminiLabs\Castor\Facades\Development')
15
-            && class_exists('\GeminiLabs\Castor\Helpers\Development')
16
-            && method_exists('\GeminiLabs\Castor\Helpers\Development', 'templatePaths')) { // @phpstan-ignore-line
14
+        if( class_exists( '\GeminiLabs\Castor\Facades\Development' )
15
+            && class_exists( '\GeminiLabs\Castor\Helpers\Development' )
16
+            && method_exists( '\GeminiLabs\Castor\Helpers\Development', 'templatePaths' ) ) { // @phpstan-ignore-line
17 17
             $this->entries = \GeminiLabs\Castor\Facades\Development::templatePaths();
18 18
         } else {
19
-            $files = array_values(array_filter(get_included_files(), function ($file) {
20
-                $bool = false !== strpos($file, '/themes/') && false === strpos($file, '/functions.php');
21
-                return (bool) apply_filters('blackbar/templates/file', $bool, $file);
22
-            }));
23
-            $this->entries = array_map(function ($file) {
24
-                return str_replace(trailingslashit(WP_CONTENT_DIR), '', $file);
25
-            }, $files);
19
+            $files = array_values( array_filter( get_included_files(), function( $file ) {
20
+                $bool = false !== strpos( $file, '/themes/' ) && false === strpos( $file, '/functions.php' );
21
+                return (bool) apply_filters( 'blackbar/templates/file', $bool, $file );
22
+            }) );
23
+            $this->entries = array_map( function( $file ) {
24
+                return str_replace( trailingslashit( WP_CONTENT_DIR ), '', $file );
25
+            }, $files );
26 26
         }
27 27
         return $this->entries;
28 28
     }
29 29
 
30 30
     public function hasEntries(): bool
31 31
     {
32
-        return !empty($this->entries());
32
+        return !empty( $this->entries() );
33 33
     }
34 34
 
35 35
     public function isVisible(): bool
@@ -39,6 +39,6 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function label(): string
41 41
     {
42
-        return __('Templates', 'blackbar');
42
+        return __( 'Templates', 'blackbar' );
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
plugin/Application.php 2 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -11,94 +11,94 @@
 block discarded – undo
11 11
 
12 12
 final class Application
13 13
 {
14
-    public const CONSOLE_HOOK = 'console';
15
-    public const ID = 'blackbar';
16
-    public const PROFILER_START_HOOK = 'timer:start';
17
-    public const PROFILER_STOP_HOOK = 'timer:stop';
14
+	public const CONSOLE_HOOK = 'console';
15
+	public const ID = 'blackbar';
16
+	public const PROFILER_START_HOOK = 'timer:start';
17
+	public const PROFILER_STOP_HOOK = 'timer:stop';
18 18
 
19
-    public $console;
20
-    public $file;
21
-    public $globals;
22
-    public $hooks;
23
-    public $profiler;
24
-    public $queries;
25
-    public $templates;
19
+	public $console;
20
+	public $file;
21
+	public $globals;
22
+	public $hooks;
23
+	public $profiler;
24
+	public $queries;
25
+	public $templates;
26 26
 
27
-    private static $instance;
27
+	private static $instance;
28 28
 
29
-    public function __construct()
30
-    {
31
-        $file = wp_normalize_path((new \ReflectionClass($this))->getFileName());
32
-        $this->console = new Console($this);
33
-        $this->file = str_replace('plugin/Application', static::ID, $file);
34
-        $this->globals = new Globals($this);
35
-        $this->hooks = new Hooks($this);
36
-        $this->profiler = new Profiler($this);
37
-        $this->queries = new Queries($this);
38
-        $this->templates = new Templates($this);
39
-    }
29
+	public function __construct()
30
+	{
31
+		$file = wp_normalize_path((new \ReflectionClass($this))->getFileName());
32
+		$this->console = new Console($this);
33
+		$this->file = str_replace('plugin/Application', static::ID, $file);
34
+		$this->globals = new Globals($this);
35
+		$this->hooks = new Hooks($this);
36
+		$this->profiler = new Profiler($this);
37
+		$this->queries = new Queries($this);
38
+		$this->templates = new Templates($this);
39
+	}
40 40
 
41
-    public function errorHandler(int $errno, string $message, string $file, int $line): bool
42
-    {
43
-        $path = explode(ABSPATH, $file);
44
-        $location = sprintf('%s:%s', array_pop($path), $line);
45
-        $this->console->store($message, (string) $errno, $location);
46
-        return true;
47
-    }
41
+	public function errorHandler(int $errno, string $message, string $file, int $line): bool
42
+	{
43
+		$path = explode(ABSPATH, $file);
44
+		$location = sprintf('%s:%s', array_pop($path), $line);
45
+		$this->console->store($message, (string) $errno, $location);
46
+		return true;
47
+	}
48 48
 
49
-    public function init(): void
50
-    {
51
-        $controller = new Controller($this);
52
-        add_action('all', [$controller, 'initConsole']);
53
-        add_action('all', [$controller, 'initHooks']);
54
-        add_action('all', [$controller, 'initProfiler']);
55
-        do_action('blackbar/profiler/start'); // start profiler
56
-        do_action('blackbar/profiler/noise'); // measure profiler noise
57
-        add_action('plugins_loaded', [$controller, 'registerLanguages']);
58
-        add_action('init', function () use ($controller) {
59
-            if (!apply_filters('blackbar/enabled', current_user_can('administrator'))) {
60
-                return;
61
-            }
62
-            add_action('admin_enqueue_scripts', [$controller, 'enqueueAssets']);
63
-            add_action('wp_enqueue_scripts', [$controller, 'enqueueAssets']);
64
-            add_action('admin_footer', [$controller, 'renderBar'], 99999);
65
-            add_action('wp_footer', [$controller, 'renderBar'], 99999);
66
-            add_filter('admin_body_class', [$controller, 'filterBodyClasses']);
67
-        });
68
-        set_error_handler([$this, 'errorHandler'], E_ALL | E_STRICT);
69
-    }
49
+	public function init(): void
50
+	{
51
+		$controller = new Controller($this);
52
+		add_action('all', [$controller, 'initConsole']);
53
+		add_action('all', [$controller, 'initHooks']);
54
+		add_action('all', [$controller, 'initProfiler']);
55
+		do_action('blackbar/profiler/start'); // start profiler
56
+		do_action('blackbar/profiler/noise'); // measure profiler noise
57
+		add_action('plugins_loaded', [$controller, 'registerLanguages']);
58
+		add_action('init', function () use ($controller) {
59
+			if (!apply_filters('blackbar/enabled', current_user_can('administrator'))) {
60
+				return;
61
+			}
62
+			add_action('admin_enqueue_scripts', [$controller, 'enqueueAssets']);
63
+			add_action('wp_enqueue_scripts', [$controller, 'enqueueAssets']);
64
+			add_action('admin_footer', [$controller, 'renderBar'], 99999);
65
+			add_action('wp_footer', [$controller, 'renderBar'], 99999);
66
+			add_filter('admin_body_class', [$controller, 'filterBodyClasses']);
67
+		});
68
+		set_error_handler([$this, 'errorHandler'], E_ALL | E_STRICT);
69
+	}
70 70
 
71
-    /**
72
-     * @return static
73
-     */
74
-    public static function load()
75
-    {
76
-        if (empty(self::$instance)) {
77
-            self::$instance = new static();
78
-        }
79
-        return self::$instance;
80
-    }
71
+	/**
72
+	 * @return static
73
+	 */
74
+	public static function load()
75
+	{
76
+		if (empty(self::$instance)) {
77
+			self::$instance = new static();
78
+		}
79
+		return self::$instance;
80
+	}
81 81
 
82
-    public function path(string $file = '', bool $realpath = true): string
83
-    {
84
-        $path = $realpath
85
-            ? plugin_dir_path($this->file)
86
-            : trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
87
-        return trailingslashit($path).ltrim(trim($file), '/');
88
-    }
82
+	public function path(string $file = '', bool $realpath = true): string
83
+	{
84
+		$path = $realpath
85
+			? plugin_dir_path($this->file)
86
+			: trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
87
+		return trailingslashit($path).ltrim(trim($file), '/');
88
+	}
89 89
 
90
-    public function render(string $view, array $data = []): void
91
-    {
92
-        $file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
93
-        if (!file_exists($file)) {
94
-            return;
95
-        }
96
-        extract($data);
97
-        include $file;
98
-    }
90
+	public function render(string $view, array $data = []): void
91
+	{
92
+		$file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
93
+		if (!file_exists($file)) {
94
+			return;
95
+		}
96
+		extract($data);
97
+		include $file;
98
+	}
99 99
 
100
-    public function url(string $path = ''): string
101
-    {
102
-        return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
103
-    }
100
+	public function url(string $path = ''): string
101
+	{
102
+		return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -28,44 +28,44 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function __construct()
30 30
     {
31
-        $file = wp_normalize_path((new \ReflectionClass($this))->getFileName());
32
-        $this->console = new Console($this);
33
-        $this->file = str_replace('plugin/Application', static::ID, $file);
34
-        $this->globals = new Globals($this);
35
-        $this->hooks = new Hooks($this);
36
-        $this->profiler = new Profiler($this);
37
-        $this->queries = new Queries($this);
38
-        $this->templates = new Templates($this);
31
+        $file = wp_normalize_path( ( new \ReflectionClass( $this ) )->getFileName() );
32
+        $this->console = new Console( $this );
33
+        $this->file = str_replace( 'plugin/Application', static::ID, $file );
34
+        $this->globals = new Globals( $this );
35
+        $this->hooks = new Hooks( $this );
36
+        $this->profiler = new Profiler( $this );
37
+        $this->queries = new Queries( $this );
38
+        $this->templates = new Templates( $this );
39 39
     }
40 40
 
41
-    public function errorHandler(int $errno, string $message, string $file, int $line): bool
41
+    public function errorHandler( int $errno, string $message, string $file, int $line ): bool
42 42
     {
43
-        $path = explode(ABSPATH, $file);
44
-        $location = sprintf('%s:%s', array_pop($path), $line);
45
-        $this->console->store($message, (string) $errno, $location);
43
+        $path = explode( ABSPATH, $file );
44
+        $location = sprintf( '%s:%s', array_pop( $path ), $line );
45
+        $this->console->store( $message, (string) $errno, $location );
46 46
         return true;
47 47
     }
48 48
 
49 49
     public function init(): void
50 50
     {
51
-        $controller = new Controller($this);
52
-        add_action('all', [$controller, 'initConsole']);
53
-        add_action('all', [$controller, 'initHooks']);
54
-        add_action('all', [$controller, 'initProfiler']);
55
-        do_action('blackbar/profiler/start'); // start profiler
56
-        do_action('blackbar/profiler/noise'); // measure profiler noise
57
-        add_action('plugins_loaded', [$controller, 'registerLanguages']);
58
-        add_action('init', function () use ($controller) {
59
-            if (!apply_filters('blackbar/enabled', current_user_can('administrator'))) {
51
+        $controller = new Controller( $this );
52
+        add_action( 'all', [ $controller, 'initConsole' ] );
53
+        add_action( 'all', [ $controller, 'initHooks' ] );
54
+        add_action( 'all', [ $controller, 'initProfiler' ] );
55
+        do_action( 'blackbar/profiler/start' ); // start profiler
56
+        do_action( 'blackbar/profiler/noise' ); // measure profiler noise
57
+        add_action( 'plugins_loaded', [ $controller, 'registerLanguages' ] );
58
+        add_action( 'init', function() use ( $controller ) {
59
+            if( !apply_filters( 'blackbar/enabled', current_user_can( 'administrator' ) ) ) {
60 60
                 return;
61 61
             }
62
-            add_action('admin_enqueue_scripts', [$controller, 'enqueueAssets']);
63
-            add_action('wp_enqueue_scripts', [$controller, 'enqueueAssets']);
64
-            add_action('admin_footer', [$controller, 'renderBar'], 99999);
65
-            add_action('wp_footer', [$controller, 'renderBar'], 99999);
66
-            add_filter('admin_body_class', [$controller, 'filterBodyClasses']);
62
+            add_action( 'admin_enqueue_scripts', [ $controller, 'enqueueAssets' ] );
63
+            add_action( 'wp_enqueue_scripts', [ $controller, 'enqueueAssets' ] );
64
+            add_action( 'admin_footer', [ $controller, 'renderBar' ], 99999 );
65
+            add_action( 'wp_footer', [ $controller, 'renderBar' ], 99999 );
66
+            add_filter( 'admin_body_class', [ $controller, 'filterBodyClasses' ] );
67 67
         });
68
-        set_error_handler([$this, 'errorHandler'], E_ALL | E_STRICT);
68
+        set_error_handler( [ $this, 'errorHandler' ], E_ALL | E_STRICT );
69 69
     }
70 70
 
71 71
     /**
@@ -73,32 +73,32 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public static function load()
75 75
     {
76
-        if (empty(self::$instance)) {
76
+        if( empty( self::$instance ) ) {
77 77
             self::$instance = new static();
78 78
         }
79 79
         return self::$instance;
80 80
     }
81 81
 
82
-    public function path(string $file = '', bool $realpath = true): string
82
+    public function path( string $file = '', bool $realpath = true ): string
83 83
     {
84 84
         $path = $realpath
85
-            ? plugin_dir_path($this->file)
86
-            : trailingslashit(WP_PLUGIN_DIR).basename(dirname($this->file));
87
-        return trailingslashit($path).ltrim(trim($file), '/');
85
+            ? plugin_dir_path( $this->file )
86
+            : trailingslashit( WP_PLUGIN_DIR ) . basename( dirname( $this->file ) );
87
+        return trailingslashit( $path ) . ltrim( trim( $file ), '/' );
88 88
     }
89 89
 
90
-    public function render(string $view, array $data = []): void
90
+    public function render( string $view, array $data = [ ] ): void
91 91
     {
92
-        $file = $this->path(sprintf('views/%s.php', str_replace('.php', '', $view)));
93
-        if (!file_exists($file)) {
92
+        $file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) );
93
+        if( !file_exists( $file ) ) {
94 94
             return;
95 95
         }
96
-        extract($data);
96
+        extract( $data );
97 97
         include $file;
98 98
     }
99 99
 
100
-    public function url(string $path = ''): string
100
+    public function url( string $path = '' ): string
101 101
     {
102
-        return esc_url(plugin_dir_url($this->file).ltrim(trim($path), '/'));
102
+        return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) );
103 103
     }
104 104
 }
Please login to merge, or discard this patch.
views/panels/console.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if (!$module->hasEntries()) : ?>
3
+<?php if( !$module->hasEntries() ) : ?>
4 4
     <div>
5 5
         <table>
6 6
             <tbody>
7 7
                 <tr>
8
-                    <td><?= esc_html__('No entries found.', 'blackbar'); ?></td>
8
+                    <td><?= esc_html__( 'No entries found.', 'blackbar' ); ?></td>
9 9
                 </tr>
10 10
             </tbody>
11 11
         </table>
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
     <div>
15 15
         <table class="glbb-grid">
16 16
             <tbody>
17
-                <?php foreach ($module->entries() as $entry) : ?>
18
-                    <tr data-errname="<?= esc_attr($entry['errname']); ?>">
17
+                <?php foreach( $module->entries() as $entry ) : ?>
18
+                    <tr data-errname="<?= esc_attr( $entry[ 'errname' ] ); ?>">
19 19
                         <td>
20
-                            <span class="glbb-info glbb-<?= $entry['errname']; ?>"><?= esc_html($entry['name']); ?></span>
20
+                            <span class="glbb-info glbb-<?= $entry[ 'errname' ]; ?>"><?= esc_html( $entry[ 'name' ] ); ?></span>
21 21
                         </td>
22 22
                         <td>
23
-                            <pre><code><?= esc_html($entry['message']); ?></code></pre>
23
+                            <pre><code><?= esc_html( $entry[ 'message' ] ); ?></code></pre>
24 24
                         </td>
25 25
                     </tr>
26 26
                 <?php endforeach; ?>
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
         </table>
29 29
     </div>
30 30
     <form>
31
-        <label><input type="checkbox" value="debug"> <?= esc_html__('Debug', 'blackbar'); ?></label>
32
-        <label><input type="checkbox" value="info"> <?= esc_html__('Info', 'blackbar'); ?></label>
33
-        <label><input type="checkbox" value="deprecated"> <?= esc_html__('Deprecated', 'blackbar'); ?></label>
34
-        <label><input type="checkbox" value="notice"> <?= esc_html__('Notice', 'blackbar'); ?></label>
35
-        <label><input type="checkbox" value="strict"> <?= esc_html__('Strict', 'blackbar'); ?></label>
36
-        <label><input type="checkbox" value="warning"> <?= esc_html__('Warning', 'blackbar'); ?></label>
37
-        <label><input type="checkbox" value="error"> <?= esc_html__('Error', 'blackbar'); ?></label>
31
+        <label><input type="checkbox" value="debug"> <?= esc_html__( 'Debug', 'blackbar' ); ?></label>
32
+        <label><input type="checkbox" value="info"> <?= esc_html__( 'Info', 'blackbar' ); ?></label>
33
+        <label><input type="checkbox" value="deprecated"> <?= esc_html__( 'Deprecated', 'blackbar' ); ?></label>
34
+        <label><input type="checkbox" value="notice"> <?= esc_html__( 'Notice', 'blackbar' ); ?></label>
35
+        <label><input type="checkbox" value="strict"> <?= esc_html__( 'Strict', 'blackbar' ); ?></label>
36
+        <label><input type="checkbox" value="warning"> <?= esc_html__( 'Warning', 'blackbar' ); ?></label>
37
+        <label><input type="checkbox" value="error"> <?= esc_html__( 'Error', 'blackbar' ); ?></label>
38 38
     </form>
39 39
 <?php endif; ?>
Please login to merge, or discard this patch.
views/panels/globals.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<?php if ($module->hasEntries()) : ?>
3
+<?php if( $module->hasEntries() ) : ?>
4 4
     <table class="glbb-grid">
5 5
         <tbody>
6
-            <?php foreach ($module->entries() as $entry) : ?>
6
+            <?php foreach( $module->entries() as $entry ) : ?>
7 7
                 <tr class="glbb-row-collapsed">
8
-                    <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html($entry['name']); ?></div></td>
8
+                    <td><div class="glbb-row-toggle dashicons-before dashicons-arrow-right"><?= esc_html( $entry[ 'name' ] ); ?></div></td>
9 9
                     <td class="glbb-row-details">
10
-                        <pre><code><?= esc_html($entry['value']); ?></code></pre></td>
10
+                        <pre><code><?= esc_html( $entry[ 'value' ] ); ?></code></pre></td>
11 11
                     </tr>
12 12
                 </tr>
13 13
             <?php endforeach; ?>
Please login to merge, or discard this patch.
views/panels/templates.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1
-<?php defined('WPINC') || die; ?>
1
+<?php defined( 'WPINC' ) || die; ?>
2 2
 
3 3
 <table class="glbb-grid">
4 4
     <tbody>
5
-        <?php foreach ($module->entries() as $index => $template) : ?>
5
+        <?php foreach( $module->entries() as $index => $template ) : ?>
6 6
             <tr>
7 7
                 <td>
8 8
                     <ol>
9
-                        <li value="<?= esc_attr($index + 1); ?>"><?= esc_html($template); ?></li>
9
+                        <li value="<?= esc_attr( $index + 1 ); ?>"><?= esc_html( $template ); ?></li>
10 10
                     </ol>
11 11
                 </td>
12 12
             </tr>
Please login to merge, or discard this patch.
plugin/Modules/Profiler.php 2 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -4,91 +4,91 @@
 block discarded – undo
4 4
 
5 5
 class Profiler extends Module
6 6
 {
7
-    /**
8
-     * @var int
9
-     */
10
-    protected $memory_start = 0;
11
-    /**
12
-     * @var int
13
-     */
14
-    protected $memory_stop = 0;
15
-    /**
16
-     * The profiler noise to remove from the timer (in nanoseconds).
17
-     * @var int
18
-     */
19
-    protected $noise = 0;
20
-    /**
21
-     * The hrtime the profiler started measuring (in nanoseconds).
22
-     * @var int
23
-     */
24
-    protected $start = 0;
25
-    /**
26
-     * The hrtime the profiler stopped measuring (in nanoseconds).
27
-     * @var int
28
-     */
29
-    protected $stop = 0;
30
-    /**
31
-     * @var array
32
-     */
33
-    protected $timer = [];
7
+	/**
8
+	 * @var int
9
+	 */
10
+	protected $memory_start = 0;
11
+	/**
12
+	 * @var int
13
+	 */
14
+	protected $memory_stop = 0;
15
+	/**
16
+	 * The profiler noise to remove from the timer (in nanoseconds).
17
+	 * @var int
18
+	 */
19
+	protected $noise = 0;
20
+	/**
21
+	 * The hrtime the profiler started measuring (in nanoseconds).
22
+	 * @var int
23
+	 */
24
+	protected $start = 0;
25
+	/**
26
+	 * The hrtime the profiler stopped measuring (in nanoseconds).
27
+	 * @var int
28
+	 */
29
+	protected $stop = 0;
30
+	/**
31
+	 * @var array
32
+	 */
33
+	protected $timer = [];
34 34
 
35
-    public function entries(): array
36
-    {
37
-        $entries = [];
38
-        foreach ($this->entries as $entry) {
39
-            $entry['time'] = $this->formatTime($entry['time']);
40
-            $entries[] = $entry;
41
-        }
42
-        return $entries;
43
-    }
35
+	public function entries(): array
36
+	{
37
+		$entries = [];
38
+		foreach ($this->entries as $entry) {
39
+			$entry['time'] = $this->formatTime($entry['time']);
40
+			$entries[] = $entry;
41
+		}
42
+		return $entries;
43
+	}
44 44
 
45
-    public function isVisible(): bool
46
-    {
47
-        return $this->hasEntries();
48
-    }
45
+	public function isVisible(): bool
46
+	{
47
+		return $this->hasEntries();
48
+	}
49 49
 
50
-    public function label(): string
51
-    {
52
-        return __('Profiler', 'blackbar');
53
-    }
50
+	public function label(): string
51
+	{
52
+		return __('Profiler', 'blackbar');
53
+	}
54 54
 
55
-    public function setNoise(int $nanoseconds): void
56
-    {
57
-        $this->noise = $nanoseconds - $this->start;
58
-    }
55
+	public function setNoise(int $nanoseconds): void
56
+	{
57
+		$this->noise = $nanoseconds - $this->start;
58
+	}
59 59
 
60
-    public function setStart(int $nanoseconds): void
61
-    {
62
-        $this->start = $nanoseconds;
63
-        $this->memory_start = memory_get_peak_usage();
64
-    }
60
+	public function setStart(int $nanoseconds): void
61
+	{
62
+		$this->start = $nanoseconds;
63
+		$this->memory_start = memory_get_peak_usage();
64
+	}
65 65
 
66
-    public function setStop(int $nanoseconds): void
67
-    {
68
-        $this->stop = $nanoseconds;
69
-        $this->memory_stop = memory_get_peak_usage();
70
-    }
66
+	public function setStop(int $nanoseconds): void
67
+	{
68
+		$this->stop = $nanoseconds;
69
+		$this->memory_stop = memory_get_peak_usage();
70
+	}
71 71
 
72
-    public function start(string $name): void
73
-    {
74
-        $this->timer = [
75
-            'memory' => memory_get_peak_usage(),
76
-            'name' => $name,
77
-            'start' => (int) hrtime(true),
78
-            'stop' => 0,
79
-            'time' => 0,
80
-        ];
81
-    }
72
+	public function start(string $name): void
73
+	{
74
+		$this->timer = [
75
+			'memory' => memory_get_peak_usage(),
76
+			'name' => $name,
77
+			'start' => (int) hrtime(true),
78
+			'stop' => 0,
79
+			'time' => 0,
80
+		];
81
+	}
82 82
 
83
-    public function stop(): void
84
-    {
85
-        if (!empty($this->timer)) {
86
-            $nanoseconds = (int) hrtime(true);
87
-            $this->timer['memory'] = max(0, memory_get_peak_usage() - $this->timer['memory']);
88
-            $this->timer['stop'] = $nanoseconds;
89
-            $this->timer['time'] = max(0, $nanoseconds - $this->timer['start'] - $this->noise);
90
-            $this->entries[] = $this->timer;
91
-            $this->timer = []; // reset timer
92
-        }
93
-    }
83
+	public function stop(): void
84
+	{
85
+		if (!empty($this->timer)) {
86
+			$nanoseconds = (int) hrtime(true);
87
+			$this->timer['memory'] = max(0, memory_get_peak_usage() - $this->timer['memory']);
88
+			$this->timer['stop'] = $nanoseconds;
89
+			$this->timer['time'] = max(0, $nanoseconds - $this->timer['start'] - $this->noise);
90
+			$this->entries[] = $this->timer;
91
+			$this->timer = []; // reset timer
92
+		}
93
+	}
94 94
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * @var array
32 32
      */
33
-    protected $timer = [];
33
+    protected $timer = [ ];
34 34
 
35 35
     public function entries(): array
36 36
     {
37
-        $entries = [];
38
-        foreach ($this->entries as $entry) {
39
-            $entry['time'] = $this->formatTime($entry['time']);
40
-            $entries[] = $entry;
37
+        $entries = [ ];
38
+        foreach( $this->entries as $entry ) {
39
+            $entry[ 'time' ] = $this->formatTime( $entry[ 'time' ] );
40
+            $entries[ ] = $entry;
41 41
         }
42 42
         return $entries;
43 43
     }
@@ -49,32 +49,32 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function label(): string
51 51
     {
52
-        return __('Profiler', 'blackbar');
52
+        return __( 'Profiler', 'blackbar' );
53 53
     }
54 54
 
55
-    public function setNoise(int $nanoseconds): void
55
+    public function setNoise( int $nanoseconds ): void
56 56
     {
57 57
         $this->noise = $nanoseconds - $this->start;
58 58
     }
59 59
 
60
-    public function setStart(int $nanoseconds): void
60
+    public function setStart( int $nanoseconds ): void
61 61
     {
62 62
         $this->start = $nanoseconds;
63 63
         $this->memory_start = memory_get_peak_usage();
64 64
     }
65 65
 
66
-    public function setStop(int $nanoseconds): void
66
+    public function setStop( int $nanoseconds ): void
67 67
     {
68 68
         $this->stop = $nanoseconds;
69 69
         $this->memory_stop = memory_get_peak_usage();
70 70
     }
71 71
 
72
-    public function start(string $name): void
72
+    public function start( string $name ): void
73 73
     {
74 74
         $this->timer = [
75 75
             'memory' => memory_get_peak_usage(),
76 76
             'name' => $name,
77
-            'start' => (int) hrtime(true),
77
+            'start' => (int) hrtime( true ),
78 78
             'stop' => 0,
79 79
             'time' => 0,
80 80
         ];
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 
83 83
     public function stop(): void
84 84
     {
85
-        if (!empty($this->timer)) {
86
-            $nanoseconds = (int) hrtime(true);
87
-            $this->timer['memory'] = max(0, memory_get_peak_usage() - $this->timer['memory']);
88
-            $this->timer['stop'] = $nanoseconds;
89
-            $this->timer['time'] = max(0, $nanoseconds - $this->timer['start'] - $this->noise);
90
-            $this->entries[] = $this->timer;
91
-            $this->timer = []; // reset timer
85
+        if( !empty( $this->timer ) ) {
86
+            $nanoseconds = (int) hrtime( true );
87
+            $this->timer[ 'memory' ] = max( 0, memory_get_peak_usage() - $this->timer[ 'memory' ] );
88
+            $this->timer[ 'stop' ] = $nanoseconds;
89
+            $this->timer[ 'time' ] = max( 0, $nanoseconds - $this->timer[ 'start' ] - $this->noise );
90
+            $this->entries[ ] = $this->timer;
91
+            $this->timer = [ ]; // reset timer
92 92
         }
93 93
     }
94 94
 }
Please login to merge, or discard this patch.
plugin/Modules/Module.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -6,80 +6,80 @@
 block discarded – undo
6 6
 
7 7
 abstract class Module
8 8
 {
9
-    /**
10
-     * @var Application
11
-     */
12
-    protected $app;
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $entries;
9
+	/**
10
+	 * @var Application
11
+	 */
12
+	protected $app;
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $entries;
17 17
 
18
-    public function __construct(Application $app)
19
-    {
20
-        $this->app = $app;
21
-        $this->entries = [];
22
-    }
18
+	public function __construct(Application $app)
19
+	{
20
+		$this->app = $app;
21
+		$this->entries = [];
22
+	}
23 23
 
24
-    public function classes(): string
25
-    {
26
-        return $this->id();
27
-    }
24
+	public function classes(): string
25
+	{
26
+		return $this->id();
27
+	}
28 28
 
29
-    abstract public function entries(): array;
29
+	abstract public function entries(): array;
30 30
 
31
-    public function hasEntries(): bool
32
-    {
33
-        return !empty($this->entries);
34
-    }
31
+	public function hasEntries(): bool
32
+	{
33
+		return !empty($this->entries);
34
+	}
35 35
 
36
-    public function id(): string
37
-    {
38
-        return sprintf('glbb-%s', $this->slug());
39
-    }
36
+	public function id(): string
37
+	{
38
+		return sprintf('glbb-%s', $this->slug());
39
+	}
40 40
 
41
-    public function info(): string
42
-    {
43
-        return '';
44
-    }
41
+	public function info(): string
42
+	{
43
+		return '';
44
+	}
45 45
 
46
-    public function isVisible(): bool
47
-    {
48
-        return true;
49
-    }
46
+	public function isVisible(): bool
47
+	{
48
+		return true;
49
+	}
50 50
 
51
-    abstract public function label(): string;
51
+	abstract public function label(): string;
52 52
 
53
-    public function render(): void
54
-    {
55
-        $this->app->render('panels/'.$this->slug(), ['module' => $this]);
56
-    }
53
+	public function render(): void
54
+	{
55
+		$this->app->render('panels/'.$this->slug(), ['module' => $this]);
56
+	}
57 57
 
58
-    public function slug(): string
59
-    {
60
-        return strtolower((new \ReflectionClass($this))->getShortName());
61
-    }
58
+	public function slug(): string
59
+	{
60
+		return strtolower((new \ReflectionClass($this))->getShortName());
61
+	}
62 62
 
63
-    protected function formatTime(int $nanoseconds): string
64
-    {
65
-        if ($nanoseconds >= 1e9) {
66
-            return sprintf('%s s', $this->toDecimal(round($nanoseconds / 1e9, 2)));
67
-        }
68
-        if ($nanoseconds >= 1e6) {
69
-            return sprintf('%s ms', $this->toDecimal(round($nanoseconds / 1e6, 2)));
70
-        }
71
-        if ($nanoseconds >= 1e3) {
72
-            return sprintf('%s µs', round($nanoseconds / 1e3));
73
-        }
74
-        return sprintf('%s ns', $nanoseconds);
75
-    }
63
+	protected function formatTime(int $nanoseconds): string
64
+	{
65
+		if ($nanoseconds >= 1e9) {
66
+			return sprintf('%s s', $this->toDecimal(round($nanoseconds / 1e9, 2)));
67
+		}
68
+		if ($nanoseconds >= 1e6) {
69
+			return sprintf('%s ms', $this->toDecimal(round($nanoseconds / 1e6, 2)));
70
+		}
71
+		if ($nanoseconds >= 1e3) {
72
+			return sprintf('%s µs', round($nanoseconds / 1e3));
73
+		}
74
+		return sprintf('%s ns', $nanoseconds);
75
+	}
76 76
 
77
-    protected function toDecimal(float $number): string
78
-    {
79
-        $number = (string) $number;
80
-        if (false !== strpos($number, '.')) {
81
-            $number = rtrim(rtrim($number, '0'), '.');
82
-        }
83
-        return $number;
84
-    }
77
+	protected function toDecimal(float $number): string
78
+	{
79
+		$number = (string) $number;
80
+		if (false !== strpos($number, '.')) {
81
+			$number = rtrim(rtrim($number, '0'), '.');
82
+		}
83
+		return $number;
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
      */
16 16
     protected $entries;
17 17
 
18
-    public function __construct(Application $app)
18
+    public function __construct( Application $app )
19 19
     {
20 20
         $this->app = $app;
21
-        $this->entries = [];
21
+        $this->entries = [ ];
22 22
     }
23 23
 
24 24
     public function classes(): string
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function hasEntries(): bool
32 32
     {
33
-        return !empty($this->entries);
33
+        return !empty( $this->entries );
34 34
     }
35 35
 
36 36
     public function id(): string
37 37
     {
38
-        return sprintf('glbb-%s', $this->slug());
38
+        return sprintf( 'glbb-%s', $this->slug() );
39 39
     }
40 40
 
41 41
     public function info(): string
@@ -52,33 +52,33 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function render(): void
54 54
     {
55
-        $this->app->render('panels/'.$this->slug(), ['module' => $this]);
55
+        $this->app->render( 'panels/' . $this->slug(), [ 'module' => $this ] );
56 56
     }
57 57
 
58 58
     public function slug(): string
59 59
     {
60
-        return strtolower((new \ReflectionClass($this))->getShortName());
60
+        return strtolower( ( new \ReflectionClass( $this ) )->getShortName() );
61 61
     }
62 62
 
63
-    protected function formatTime(int $nanoseconds): string
63
+    protected function formatTime( int $nanoseconds ): string
64 64
     {
65
-        if ($nanoseconds >= 1e9) {
66
-            return sprintf('%s s', $this->toDecimal(round($nanoseconds / 1e9, 2)));
65
+        if( $nanoseconds >= 1e9 ) {
66
+            return sprintf( '%s s', $this->toDecimal( round( $nanoseconds / 1e9, 2 ) ) );
67 67
         }
68
-        if ($nanoseconds >= 1e6) {
69
-            return sprintf('%s ms', $this->toDecimal(round($nanoseconds / 1e6, 2)));
68
+        if( $nanoseconds >= 1e6 ) {
69
+            return sprintf( '%s ms', $this->toDecimal( round( $nanoseconds / 1e6, 2 ) ) );
70 70
         }
71
-        if ($nanoseconds >= 1e3) {
72
-            return sprintf('%s µs', round($nanoseconds / 1e3));
71
+        if( $nanoseconds >= 1e3 ) {
72
+            return sprintf( '%s µs', round( $nanoseconds / 1e3 ) );
73 73
         }
74
-        return sprintf('%s ns', $nanoseconds);
74
+        return sprintf( '%s ns', $nanoseconds );
75 75
     }
76 76
 
77
-    protected function toDecimal(float $number): string
77
+    protected function toDecimal( float $number ): string
78 78
     {
79 79
         $number = (string) $number;
80
-        if (false !== strpos($number, '.')) {
81
-            $number = rtrim(rtrim($number, '0'), '.');
80
+        if( false !== strpos( $number, '.' ) ) {
81
+            $number = rtrim( rtrim( $number, '0' ), '.' );
82 82
         }
83 83
         return $number;
84 84
     }
Please login to merge, or discard this patch.