Passed
Push — master ( 39eaa9...f7168a )
by Paul
02:04
created
src/Application.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 	public function __construct()
19 19
 	{
20
-		$this->file = realpath( dirname( __DIR__ ).'/'.static::ID.'.php' );
20
+		$this->file = realpath( dirname( __DIR__ ) . '/' . static::ID . '.php' );
21 21
 		$this->profiler = new Profiler;
22 22
 	}
23 23
 
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 			8192 => 'Deprecated',
38 38
 		);
39 39
 		$errname = array_key_exists( $errno, $errorCodes )
40
-			? $errorCodes[$errno]
40
+			? $errorCodes[ $errno ]
41 41
 			: 'Unknown';
42
-		$hash = md5( $errno.$errstr.$errfile.$errline );
43
-		if( array_key_exists( $hash, $this->errors )) {
44
-			$this->errors[$hash]['count']++;
42
+		$hash = md5( $errno . $errstr . $errfile . $errline );
43
+		if( array_key_exists( $hash, $this->errors ) ) {
44
+			$this->errors[ $hash ][ 'count' ]++;
45 45
 		}
46 46
 		else {
47
-			$this->errors[$hash] = array(
47
+			$this->errors[ $hash ] = array(
48 48
 				"errno" => $errno,
49 49
 				"message" => $errstr,
50 50
 				"file" => $errfile,
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
 	public function init()
62 62
 	{
63 63
 		$controller = new Controller( $this );
64
-		add_action( 'admin_enqueue_scripts',    array( $controller, 'enqueueAssets' ));
65
-		add_action( 'wp_enqueue_scripts',       array( $controller, 'enqueueAssets' ));
66
-		add_action( 'plugins_loaded',           array( $controller, 'registerLanguages' ));
67
-		add_action( 'admin_footer',             array( $controller, 'renderBar' ));
68
-		add_action( 'wp_footer',                array( $controller, 'renderBar' ));
69
-		add_filter( 'admin_body_class',         array( $controller, 'filterBodyClasses' ));
70
-		add_filter( 'gform_noconflict_scripts', array( $controller, 'filterNoconflictScripts' ));
71
-		add_filter( 'gform_noconflict_styles',  array( $controller, 'filterNoconflictStyles' ));
72
-		add_filter( 'all',                      array( $controller, 'initProfiler' ));
64
+		add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' ) );
65
+		add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' ) );
66
+		add_action( 'plugins_loaded', array( $controller, 'registerLanguages' ) );
67
+		add_action( 'admin_footer', array( $controller, 'renderBar' ) );
68
+		add_action( 'wp_footer', array( $controller, 'renderBar' ) );
69
+		add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' ) );
70
+		add_filter( 'gform_noconflict_scripts', array( $controller, 'filterNoconflictScripts' ) );
71
+		add_filter( 'gform_noconflict_styles', array( $controller, 'filterNoconflictStyles' ) );
72
+		add_filter( 'all', array( $controller, 'initProfiler' ) );
73 73
 		apply_filters( 'debug', 'Profiler Started' );
74 74
 		apply_filters( 'debug', 'blackbar/profiler/noise' );
75
-		set_error_handler( array( $this, 'errorHandler' ), E_ALL|E_STRICT );
75
+		set_error_handler( array( $this, 'errorHandler' ), E_ALL | E_STRICT );
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function path( $file = '' )
83 83
 	{
84
-		return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' );
84
+		return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' );
85 85
 	}
86 86
 
87 87
 	/**
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function render( $view, array $data = array() )
92 92
 	{
93
-		$file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view )));
94
-		if( !file_exists( $file ))return;
93
+		$file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) );
94
+		if( !file_exists( $file ) )return;
95 95
 		extract( $data );
96 96
 		include $file;
97 97
 	}
@@ -102,6 +102,6 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function url( $path = '' )
104 104
 	{
105
-		return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
105
+		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) );
106 106
 	}
107 107
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@
 block discarded – undo
91 91
 	public function render( $view, array $data = array() )
92 92
 	{
93 93
 		$file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view )));
94
-		if( !file_exists( $file ))return;
94
+		if( !file_exists( $file )) {
95
+			return;
96
+		}
95 97
 		extract( $data );
96 98
 		include $file;
97 99
 	}
Please login to merge, or discard this patch.
src/Controller.php 2 patches
Spacing   +33 added lines, -33 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,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function filterNoconflictScripts( $scripts )
46 46
 	{
47
-		$scripts[] = Application::ID;
47
+		$scripts[ ] = Application::ID;
48 48
 		return $scripts;
49 49
 	}
50 50
 
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function filterNoconflictStyles( $styles )
56 56
 	{
57
-		$styles[] = Application::ID;
58
-		$styles[] = Application::ID.'-syntax';
57
+		$styles[ ] = Application::ID;
58
+		$styles[ ] = Application::ID . '-syntax';
59 59
 		return $styles;
60 60
 	}
61 61
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function initProfiler()
67 67
 	{
68
-		if( func_get_arg(0) != Application::DEBUG )return;
69
-		$this->app->profiler->trace( func_get_arg(1) );
68
+		if( func_get_arg( 0 ) != Application::DEBUG )return;
69
+		$this->app->profiler->trace( func_get_arg( 1 ) );
70 70
 	}
71 71
 
72 72
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	public function registerLanguages()
77 77
 	{
78 78
 		load_plugin_textdomain( Application::ID, false,
79
-			plugin_basename( $this->app->path() ).Application::LANG
79
+			plugin_basename( $this->app->path() ) . Application::LANG
80 80
 		);
81 81
 	}
82 82
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			'queries' => $this->getQueries(),
98 98
 			'queriesLabel' => $this->getQueriesLabel(),
99 99
 			'templates' => $this->getTemplates(),
100
-		));
100
+		) );
101 101
 	}
102 102
 
103 103
 	/**
@@ -115,18 +115,18 @@  discard block
 block discarded – undo
115 115
 	{
116 116
 		$errors = array();
117 117
 		foreach( $this->app->errors as $error ) {
118
-			if( $error['errno'] == E_WARNING ) {
119
-				$error['name'] = '<span class="glbb-error">'.$error['name'].'</span>';
118
+			if( $error[ 'errno' ] == E_WARNING ) {
119
+				$error[ 'name' ] = '<span class="glbb-error">' . $error[ 'name' ] . '</span>';
120 120
 			}
121
-			if( $error['count'] > 1 ) {
122
-				$error['name'] .= ' ('.$error['count'].')';
121
+			if( $error[ 'count' ] > 1 ) {
122
+				$error[ 'name' ] .= ' (' . $error[ 'count' ] . ')';
123 123
 			}
124
-			$errors[] = array(
125
-				'name' => $error['name'],
124
+			$errors[ ] = array(
125
+				'name' => $error[ 'name' ],
126 126
 				'message' => sprintf( __( '%s on line %s in file %s', 'blackbar' ),
127
-					$error['message'],
128
-					$error['line'],
129
-					$error['file']
127
+					$error[ 'message' ],
128
+					$error[ 'line' ],
129
+					$error[ 'file' ]
130 130
 				),
131 131
 			);
132 132
 		}
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	{
141 141
 		$warningCount = 0;
142 142
 		foreach( $this->app->errors as $error ) {
143
-			if( $error['errno'] == E_WARNING ) {
143
+			if( $error[ 'errno' ] == E_WARNING ) {
144 144
 				$warningCount++;
145 145
 			}
146 146
 		}
147 147
 		$errorCount = count( $this->app->errors );
148 148
 		$warnings = $warningCount > 0 ? sprintf( ', %d!', $warningCount ) : '';
149
-		return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount.$warnings );
149
+		return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount . $warnings );
150 150
 	}
151 151
 
152 152
 	/**
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 		$files = array_values( array_filter( get_included_files(), function( $file ) {
158 158
 			$bool = strpos( $file, '/themes/' ) !== false
159 159
 				&& strpos( $file, '/functions.php' ) === false;
160
-			return (bool)apply_filters( 'blackbar/templates/file', $bool, $file );
161
-		}));
160
+			return (bool) apply_filters( 'blackbar/templates/file', $bool, $file );
161
+		}) );
162 162
 		return array_map( function( $key, $value ) {
163 163
 			$value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value );
164 164
 			return sprintf( '[%s] => %s', $key, $value );
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 			'ORDER BY', 'SET', 'WHERE',
187 187
 		);
188 188
 		$replace = array_map( function( $value ) {
189
-			return PHP_EOL.$value;
189
+			return PHP_EOL . $value;
190 190
 		}, $search );
191 191
 		foreach( $wpdb->queries as $query ) {
192
-			$miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 );
193
-			$sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] ));
192
+			$miliseconds = number_format( round( $query[ 1 ] * 1000, 4 ), 4 );
193
+			$sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) );
194 194
 			$sql = str_replace( PHP_EOL, ' ', $sql );
195 195
 			$sql = str_replace( $search, $replace, $sql );
196
-			$queries[] = array(
196
+			$queries[ ] = array(
197 197
 				'ms' => $miliseconds,
198 198
 				'sql' => $sql,
199 199
 			);
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 		global $wpdb;
213 213
 		$queryTime = 0;
214 214
 		foreach( $wpdb->queries as $query ) {
215
-			$queryTime += $query[1];
215
+			$queryTime += $query[ 1 ];
216 216
 		}
217
-		$queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>';
218
-		$queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>';
217
+		$queriesCount = '<span class="glbb-queries-count">' . count( $wpdb->queries ) . '</span>';
218
+		$queriesTime = '<span class="glbb-queries-time">' . $this->convertToMiliseconds( $queryTime ) . '</span>';
219 219
 		return sprintf( __( 'SQL (%s queries in %s ms)', 'blackbar' ), $queriesCount, $queriesTime );
220 220
 	}
221 221
 
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	protected function getTemplates()
226 226
 	{
227 227
 		if( is_admin() )return;
228
-		if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) {
228
+		if( class_exists( '\GeminiLabs\Castor\Facades\Development' ) ) {
229 229
 			ob_start();
230 230
 			\GeminiLabs\Castor\Facades\Development::printTemplatePaths();
231 231
 			return ob_get_clean();
232 232
 		}
233
-		return '<pre>'.implode( PHP_EOL, $this->getIncludedFiles() ).'</pre>';
233
+		return '<pre>' . implode( PHP_EOL, $this->getIncludedFiles() ) . '</pre>';
234 234
 	}
235 235
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,7 +65,9 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function initProfiler()
67 67
 	{
68
-		if( func_get_arg(0) != Application::DEBUG )return;
68
+		if( func_get_arg(0) != Application::DEBUG ) {
69
+			return;
70
+		}
69 71
 		$this->app->profiler->trace( func_get_arg(1) );
70 72
 	}
71 73
 
@@ -154,12 +156,14 @@  discard block
 block discarded – undo
154 156
 	 */
155 157
 	protected function getIncludedFiles()
156 158
 	{
157
-		$files = array_values( array_filter( get_included_files(), function( $file ) {
159
+		$files = array_values( array_filter( get_included_files(), function( $file )
160
+		{
158 161
 			$bool = strpos( $file, '/themes/' ) !== false
159 162
 				&& strpos( $file, '/functions.php' ) === false;
160 163
 			return (bool)apply_filters( 'blackbar/templates/file', $bool, $file );
161 164
 		}));
162
-		return array_map( function( $key, $value ) {
165
+		return array_map( function( $key, $value )
166
+		{
163 167
 			$value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value );
164 168
 			return sprintf( '[%s] => %s', $key, $value );
165 169
 		}, array_keys( $files ), $files );
@@ -185,7 +189,8 @@  discard block
 block discarded – undo
185 189
 			'AND', 'FROM', 'GROUP BY', 'INNER JOIN', 'LIMIT', 'ON DUPLICATE KEY UPDATE',
186 190
 			'ORDER BY', 'SET', 'WHERE',
187 191
 		);
188
-		$replace = array_map( function( $value ) {
192
+		$replace = array_map( function( $value )
193
+		{
189 194
 			return PHP_EOL.$value;
190 195
 		}, $search );
191 196
 		foreach( $wpdb->queries as $query ) {
@@ -224,7 +229,9 @@  discard block
 block discarded – undo
224 229
 	 */
225 230
 	protected function getTemplates()
226 231
 	{
227
-		if( is_admin() )return;
232
+		if( is_admin() ) {
233
+			return;
234
+		}
228 235
 		if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) {
229 236
 			ob_start();
230 237
 			\GeminiLabs\Castor\Facades\Development::printTemplatePaths();
Please login to merge, or discard this patch.