Passed
Push — master ( bda68a...d8901e )
by Paul
02:55
created
src/Controller.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function enqueueAssets()
25 25
 	{
26
-		wp_enqueue_script( Application::ID, $this->app->url( 'assets/main.js' ));
27
-		wp_enqueue_style( Application::ID, $this->app->url( 'assets/main.css' ), array( 'dashicons' ));
28
-		wp_enqueue_style( Application::ID.'-syntax', $this->app->url( 'assets/syntax.css' ));
26
+		wp_enqueue_script( Application::ID, $this->app->url( 'assets/main.js' ) );
27
+		wp_enqueue_style( Application::ID, $this->app->url( 'assets/main.css' ), array( 'dashicons' ) );
28
+		wp_enqueue_style( Application::ID . '-syntax', $this->app->url( 'assets/syntax.css' ) );
29 29
 	}
30 30
 
31 31
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function filterBodyClasses( $classes )
37 37
 	{
38
-		return trim( $classes.' '.Application::ID );
38
+		return trim( $classes . ' ' . Application::ID );
39 39
 	}
40 40
 
41 41
 	/**
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function initConsole()
46 46
 	{
47
-		if( func_get_arg(0) != Application::CONSOLE_HOOK )return;
47
+		if( func_get_arg( 0 ) != Application::CONSOLE_HOOK )return;
48 48
 		$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
49 49
 		$entry = array_pop( $backtrace );
50 50
 		$location = '';
51
-		if( array_key_exists( 'file', $entry )) {
52
-			$path = explode( ABSPATH, $entry['file'] );
53
-			$location = sprintf( '[%s:%s] ', array_pop( $path ), $entry['line'] );
51
+		if( array_key_exists( 'file', $entry ) ) {
52
+			$path = explode( ABSPATH, $entry[ 'file' ] );
53
+			$location = sprintf( '[%s:%s] ', array_pop( $path ), $entry[ 'line' ] );
54 54
 		}
55
-		$this->app->console->store( func_get_arg(1), $location );
55
+		$this->app->console->store( func_get_arg( 1 ), $location );
56 56
 	}
57 57
 
58 58
 	/**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function initProfiler()
63 63
 	{
64
-		if( func_get_arg(0) != Application::PROFILER_HOOK )return;
65
-		$this->app->profiler->trace( func_get_arg(1) );
64
+		if( func_get_arg( 0 ) != Application::PROFILER_HOOK )return;
65
+		$this->app->profiler->trace( func_get_arg( 1 ) );
66 66
 	}
67 67
 
68 68
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function registerLanguages()
73 73
 	{
74 74
 		load_plugin_textdomain( Application::ID, false,
75
-			plugin_basename( $this->app->path() ).Application::LANG
75
+			plugin_basename( $this->app->path() ) . Application::LANG
76 76
 		);
77 77
 	}
78 78
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			'queries' => $this->getQueries(),
94 94
 			'queriesLabel' => $this->getQueriesLabel(),
95 95
 			'templates' => $this->getTemplates(),
96
-		));
96
+		) );
97 97
 	}
98 98
 
99 99
 	/**
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 		$entries = $this->getConsoleEntries();
124 124
 		$errorCount = 0;
125 125
 		foreach( $entries as $entry ) {
126
-			if( in_array( $entry['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED] )) {
126
+			if( in_array( $entry[ 'errno' ], [ E_NOTICE, E_STRICT, E_DEPRECATED ] ) ) {
127 127
 				$class = 'glbb-warning';
128 128
 			}
129
-			if( in_array( $entry['errno'], [E_WARNING] )) {
129
+			if( in_array( $entry[ 'errno' ], [ E_WARNING ] ) ) {
130 130
 				$errorCount++;
131 131
 			}
132 132
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			$entryCount .= sprintf( ', %d!', $errorCount );
137 137
 		}
138 138
 		$label = sprintf( __( 'Console (%s)', 'blackbar' ), $entryCount );
139
-		return '<span class="'.$class.'">'.$label.'</span>';
139
+		return '<span class="' . $class . '">' . $label . '</span>';
140 140
 	}
141 141
 
142 142
 	/**
@@ -147,22 +147,22 @@  discard block
 block discarded – undo
147 147
 		$errors = array();
148 148
 		foreach( $this->app->errors as $error ) {
149 149
 			$class = 'glbb-info';
150
-			if( in_array( $error['errno'], [E_NOTICE, E_STRICT, E_DEPRECATED] )) {
150
+			if( in_array( $error[ 'errno' ], [ E_NOTICE, E_STRICT, E_DEPRECATED ] ) ) {
151 151
 				$class = 'glbb-warning';
152 152
 			}
153
-			if( $error['errno'] == E_WARNING ) {
153
+			if( $error[ 'errno' ] == E_WARNING ) {
154 154
 				$class = 'glbb-error';
155 155
 			}
156
-			if( $error['count'] > 1 ) {
157
-				$error['name'] .= ' ('.$error['count'].')';
156
+			if( $error[ 'count' ] > 1 ) {
157
+				$error[ 'name' ] .= ' (' . $error[ 'count' ] . ')';
158 158
 			}
159
-			$errors[] = array(
160
-				'errno' => $error['errno'],
161
-				'name' => '<span class="'.$class.'">'.$error['name'].'</span>',
159
+			$errors[ ] = array(
160
+				'errno' => $error[ 'errno' ],
161
+				'name' => '<span class="' . $class . '">' . $error[ 'name' ] . '</span>',
162 162
 				'message' => sprintf( __( '%s on line %s in file %s', 'blackbar' ),
163
-					$error['message'],
164
-					$error['line'],
165
-					$error['file']
163
+					$error[ 'message' ],
164
+					$error[ 'line' ],
165
+					$error[ 'file' ]
166 166
 				),
167 167
 			);
168 168
 		}
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 		$files = array_values( array_filter( get_included_files(), function( $file ) {
178 178
 			$bool = strpos( $file, '/themes/' ) !== false
179 179
 				&& strpos( $file, '/functions.php' ) === false;
180
-			return (bool)apply_filters( 'blackbar/templates/file', $bool, $file );
181
-		}));
180
+			return (bool) apply_filters( 'blackbar/templates/file', $bool, $file );
181
+		}) );
182 182
 		return array_map( function( $key, $value ) {
183 183
 			$value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value );
184 184
 			return sprintf( '[%s] => %s', $key, $value );
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 			'ORDER BY', 'SET', 'WHERE',
207 207
 		);
208 208
 		$replace = array_map( function( $value ) {
209
-			return PHP_EOL.$value;
209
+			return PHP_EOL . $value;
210 210
 		}, $search );
211 211
 		foreach( $wpdb->queries as $query ) {
212
-			$miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 );
213
-			$sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] ));
212
+			$miliseconds = number_format( round( $query[ 1 ] * 1000, 4 ), 4 );
213
+			$sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) );
214 214
 			$sql = str_replace( PHP_EOL, ' ', $sql );
215 215
 			$sql = str_replace( $search, $replace, $sql );
216
-			$queries[] = array(
216
+			$queries[ ] = array(
217 217
 				'ms' => $miliseconds,
218 218
 				'sql' => $sql,
219 219
 			);
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
 		global $wpdb;
233 233
 		$queryTime = 0;
234 234
 		foreach( $wpdb->queries as $query ) {
235
-			$queryTime += $query[1];
235
+			$queryTime += $query[ 1 ];
236 236
 		}
237
-		$queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>';
238
-		$queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>';
237
+		$queriesCount = '<span class="glbb-queries-count">' . count( $wpdb->queries ) . '</span>';
238
+		$queriesTime = '<span class="glbb-queries-time">' . $this->convertToMiliseconds( $queryTime ) . '</span>';
239 239
 		return sprintf( __( 'SQL (%s queries | %s ms)', 'blackbar' ), $queriesCount, $queriesTime );
240 240
 	}
241 241
 
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	protected function getTemplates()
246 246
 	{
247 247
 		if( is_admin() )return;
248
-		if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) {
248
+		if( class_exists( '\GeminiLabs\Castor\Facades\Development' ) ) {
249 249
 			ob_start();
250 250
 			\GeminiLabs\Castor\Facades\Development::printTemplatePaths();
251 251
 			return ob_get_clean();
252 252
 		}
253
-		return '<pre>'.implode( PHP_EOL, $this->getIncludedFiles() ).'</pre>';
253
+		return '<pre>' . implode( PHP_EOL, $this->getIncludedFiles() ) . '</pre>';
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function initConsole()
46 46
 	{
47
-		if( func_get_arg(0) != Application::CONSOLE_HOOK )return;
47
+		if( func_get_arg(0) != Application::CONSOLE_HOOK ) {
48
+			return;
49
+		}
48 50
 		$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
49 51
 		$entry = array_pop( $backtrace );
50 52
 		$location = '';
@@ -61,7 +63,9 @@  discard block
 block discarded – undo
61 63
 	 */
62 64
 	public function initProfiler()
63 65
 	{
64
-		if( func_get_arg(0) != Application::PROFILER_HOOK )return;
66
+		if( func_get_arg(0) != Application::PROFILER_HOOK ) {
67
+			return;
68
+		}
65 69
 		$this->app->profiler->trace( func_get_arg(1) );
66 70
 	}
67 71
 
@@ -174,12 +178,14 @@  discard block
 block discarded – undo
174 178
 	 */
175 179
 	protected function getIncludedFiles()
176 180
 	{
177
-		$files = array_values( array_filter( get_included_files(), function( $file ) {
181
+		$files = array_values( array_filter( get_included_files(), function( $file )
182
+		{
178 183
 			$bool = strpos( $file, '/themes/' ) !== false
179 184
 				&& strpos( $file, '/functions.php' ) === false;
180 185
 			return (bool)apply_filters( 'blackbar/templates/file', $bool, $file );
181 186
 		}));
182
-		return array_map( function( $key, $value ) {
187
+		return array_map( function( $key, $value )
188
+		{
183 189
 			$value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value );
184 190
 			return sprintf( '[%s] => %s', $key, $value );
185 191
 		}, array_keys( $files ), $files );
@@ -205,7 +211,8 @@  discard block
 block discarded – undo
205 211
 			'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LIMIT', 'ON DUPLICATE KEY UPDATE',
206 212
 			'ORDER BY', 'SET', 'WHERE',
207 213
 		);
208
-		$replace = array_map( function( $value ) {
214
+		$replace = array_map( function( $value )
215
+		{
209 216
 			return PHP_EOL.$value;
210 217
 		}, $search );
211 218
 		foreach( $wpdb->queries as $query ) {
@@ -244,7 +251,9 @@  discard block
 block discarded – undo
244 251
 	 */
245 252
 	protected function getTemplates()
246 253
 	{
247
-		if( is_admin() )return;
254
+		if( is_admin() ) {
255
+			return;
256
+		}
248 257
 		if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) {
249 258
 			ob_start();
250 259
 			\GeminiLabs\Castor\Facades\Development::printTemplatePaths();
Please login to merge, or discard this patch.
blackbar.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 
19 19
 defined( 'WPINC' ) || die;
20 20
 
21
-if( !class_exists( 'GL_Plugin_Check_v3' )) {
22
-	require_once __DIR__.'/activate.php';
21
+if( !class_exists( 'GL_Plugin_Check_v3' ) ) {
22
+	require_once __DIR__ . '/activate.php';
23 23
 }
24
-if( !(new GL_Plugin_Check_v3( __FILE__, array( 'php' => '5.6', 'wordpress' => '4.7.0' )))->canProceed() )return;
25
-require_once __DIR__.'/autoload.php';
26
-require_once __DIR__.'/compatibility.php';
24
+if( !( new GL_Plugin_Check_v3( __FILE__, array( 'php' => '5.6', 'wordpress' => '4.7.0' ) ) )->canProceed() )return;
25
+require_once __DIR__ . '/autoload.php';
26
+require_once __DIR__ . '/compatibility.php';
27 27
 
28
-if( !defined( 'SAVEQUERIES' )) {
28
+if( !defined( 'SAVEQUERIES' ) ) {
29 29
 	define( 'SAVEQUERIES', 1 );
30 30
 }
31
-(new GeminiLabs\BlackBar\Application)->init();
31
+( new GeminiLabs\BlackBar\Application )->init();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@
 block discarded – undo
21 21
 if( !class_exists( 'GL_Plugin_Check_v3' )) {
22 22
 	require_once __DIR__.'/activate.php';
23 23
 }
24
-if( !(new GL_Plugin_Check_v3( __FILE__, array( 'php' => '5.6', 'wordpress' => '4.7.0' )))->canProceed() )return;
24
+if( !(new GL_Plugin_Check_v3( __FILE__, array( 'php' => '5.6', 'wordpress' => '4.7.0' )))->canProceed() ) {
25
+	return;
26
+}
25 27
 require_once __DIR__.'/autoload.php';
26 28
 require_once __DIR__.'/compatibility.php';
27 29
 
Please login to merge, or discard this patch.
views/debug-bar.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@
 block discarded – undo
5 5
 
6 6
 	<a href="javascript:Blackbar.switchPanel('glbb-console')" class="glbb-console"><?= $consoleLabel; ?></a>
7 7
 	<div id="glbb-console" class="glbb-debug-panel">
8
-		<?php $blackbar->render( 'panels/console', array( 'entries' => $consoleEntries )); ?>
8
+		<?php $blackbar->render( 'panels/console', array( 'entries' => $consoleEntries ) ); ?>
9 9
 	</div>
10 10
 
11 11
 	<a href="javascript:Blackbar.switchPanel('glbb-profiler')" class="glbb-profiler"><?= $profilerLabel; ?></a>
12 12
 	<div id="glbb-profiler" class="glbb-debug-panel">
13
-		<?php $blackbar->render( 'panels/profiler', array( 'profiler' => $profiler )); ?>
13
+		<?php $blackbar->render( 'panels/profiler', array( 'profiler' => $profiler ) ); ?>
14 14
 	</div>
15 15
 
16 16
 	<a href="javascript:Blackbar.switchPanel('glbb-queries')" class="glbb-queries"><?= $queriesLabel; ?></a>
17 17
 	<div id="glbb-queries" class="glbb-debug-panel">
18
-		<?php $blackbar->render( 'panels/queries', array( 'queries' => $queries )); ?>
18
+		<?php $blackbar->render( 'panels/queries', array( 'queries' => $queries ) ); ?>
19 19
 	</div>
20 20
 
21 21
 	<?php if( !is_admin() ) : ?>
22 22
 	<a href="javascript:Blackbar.switchPanel('glbb-templates')" class="glbb-templates"><?= __( 'Templates', 'blackbar' ); ?></a>
23 23
 	<div id="glbb-templates" class="glbb-debug-panel">
24
-		<?php $blackbar->render( 'panels/templates', array( 'templates' => $templates )); ?>
24
+		<?php $blackbar->render( 'panels/templates', array( 'templates' => $templates ) ); ?>
25 25
 	</div>
26 26
 	<?php endif; ?>
27 27
 
Please login to merge, or discard this patch.