Passed
Push — master ( bda68a...d8901e )
by Paul
02:55
created
views/panels/queries.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,12 @@
 block discarded – undo
8 8
 		</tr>
9 9
 	</tbody>
10 10
 </table>
11
-<?php else : ?>
11
+<?php else {
12
+	: ?>
12 13
 <form method="get" class="glbb-queries-filter">
13
-	<input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __( 'Find queries containing', 'blackbar' ); ?>">
14
+	<input type="text" name="glbb_query_filter" id="glbb_query_filter" placeholder="<?= __( 'Find queries containing', 'blackbar' );
15
+}
16
+?>">
14 17
 	<input type="text" name="glbb_query_min_time" id="glbb_query_min_time" placeholder="<?= __( 'Minimum Execution Time', 'blackbar' ); ?>">
15 18
 </form>
16 19
 <table class="glbb-queries-table">
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
 	<tbody>
18 18
 		<?php foreach( $queries as $query ) : ?>
19 19
 		<tr>
20
-			<td class="glbb-small"><?= $query['ms']; ?></td>
21
-			<td><pre><code class="sql"><?= $query['sql']; ?></code></pre></td>
20
+			<td class="glbb-small"><?= $query[ 'ms' ]; ?></td>
21
+			<td><pre><code class="sql"><?= $query[ 'sql' ]; ?></code></pre></td>
22 22
 		</tr>
23 23
 		<?php endforeach; ?>
24 24
 	</tbody>
Please login to merge, or discard this patch.
src/Application.php 2 patches
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.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	public function __construct()
22 22
 	{
23 23
 		$this->console = new Console;
24
-		$this->file = realpath( dirname( __DIR__ ).'/'.static::ID.'.php' );
24
+		$this->file = realpath( dirname( __DIR__ ) . '/' . static::ID . '.php' );
25 25
 		$this->profiler = new Profiler;
26 26
 	}
27 27
 
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 			8192 => 'Deprecated', //E_DEPRECATED
42 42
 		);
43 43
 		$errname = array_key_exists( $errno, $errorCodes )
44
-			? $errorCodes[$errno]
44
+			? $errorCodes[ $errno ]
45 45
 			: 'Unknown';
46
-		$hash = md5( $errno.$errstr.$errfile.$errline );
47
-		if( array_key_exists( $hash, $this->errors )) {
48
-			$this->errors[$hash]['count']++;
46
+		$hash = md5( $errno . $errstr . $errfile . $errline );
47
+		if( array_key_exists( $hash, $this->errors ) ) {
48
+			$this->errors[ $hash ][ 'count' ]++;
49 49
 		}
50 50
 		else {
51
-			$this->errors[$hash] = array(
51
+			$this->errors[ $hash ] = array(
52 52
 				"errno" => $errno,
53 53
 				"message" => $errstr,
54 54
 				"file" => $errfile,
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
 	public function init()
66 66
 	{
67 67
 		$controller = new Controller( $this );
68
-		add_action( 'admin_enqueue_scripts',    array( $controller, 'enqueueAssets' ));
69
-		add_action( 'wp_enqueue_scripts',       array( $controller, 'enqueueAssets' ));
70
-		add_action( 'plugins_loaded',           array( $controller, 'registerLanguages' ));
71
-		add_action( 'admin_footer',             array( $controller, 'renderBar' ));
72
-		add_action( 'wp_footer',                array( $controller, 'renderBar' ));
73
-		add_filter( 'admin_body_class',         array( $controller, 'filterBodyClasses' ));
74
-		add_filter( 'all',                      array( $controller, 'initConsole' ));
75
-		add_filter( 'all',                      array( $controller, 'initProfiler' ));
68
+		add_action( 'admin_enqueue_scripts', array( $controller, 'enqueueAssets' ) );
69
+		add_action( 'wp_enqueue_scripts', array( $controller, 'enqueueAssets' ) );
70
+		add_action( 'plugins_loaded', array( $controller, 'registerLanguages' ) );
71
+		add_action( 'admin_footer', array( $controller, 'renderBar' ) );
72
+		add_action( 'wp_footer', array( $controller, 'renderBar' ) );
73
+		add_filter( 'admin_body_class', array( $controller, 'filterBodyClasses' ) );
74
+		add_filter( 'all', array( $controller, 'initConsole' ) );
75
+		add_filter( 'all', array( $controller, 'initProfiler' ) );
76 76
 		apply_filters( 'debug', 'Profiler Started' );
77 77
 		apply_filters( 'debug', 'blackbar/profiler/noise' );
78
-		set_error_handler( array( $this, 'errorHandler' ), E_ALL|E_STRICT );
78
+		set_error_handler( array( $this, 'errorHandler' ), E_ALL | E_STRICT );
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function path( $file = '' )
86 86
 	{
87
-		return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' );
87
+		return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' );
88 88
 	}
89 89
 
90 90
 	/**
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function render( $view, array $data = array() )
95 95
 	{
96
-		$file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view )));
97
-		if( !file_exists( $file ))return;
96
+		$file = $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) );
97
+		if( !file_exists( $file ) )return;
98 98
 		extract( $data );
99 99
 		include $file;
100 100
 	}
@@ -105,6 +105,6 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function url( $path = '' )
107 107
 	{
108
-		return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ));
108
+		return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) );
109 109
 	}
110 110
 }
Please login to merge, or discard this patch.
autoload.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 spl_autoload_register( function( $class )
9 9
 {
10 10
 	$namespaces = [
11
-		'GeminiLabs\\BlackBar\\' => __DIR__.'/src/',
12
-		'GeminiLabs\\BlackBar\\Tests\\' => __DIR__.'/tests/',
11
+		'GeminiLabs\\BlackBar\\' => __DIR__ . '/src/',
12
+		'GeminiLabs\\BlackBar\\Tests\\' => __DIR__ . '/tests/',
13 13
 	];
14 14
 	foreach( $namespaces as $prefix => $base_dir ) {
15 15
 		$len = strlen( $prefix );
16 16
 		if( strncmp( $prefix, $class, $len ) !== 0 )continue;
17
-		$file = $base_dir.str_replace( '\\', '/', substr( $class, $len )).'.php';
18
-		if( !file_exists( $file ))continue;
17
+		$file = $base_dir . str_replace( '\\', '/', substr( $class, $len ) ) . '.php';
18
+		if( !file_exists( $file ) )continue;
19 19
 		require $file;
20 20
 		break;
21 21
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,9 +13,13 @@
 block discarded – undo
13 13
 	];
14 14
 	foreach( $namespaces as $prefix => $base_dir ) {
15 15
 		$len = strlen( $prefix );
16
-		if( strncmp( $prefix, $class, $len ) !== 0 )continue;
16
+		if( strncmp( $prefix, $class, $len ) !== 0 ) {
17
+			continue;
18
+		}
17 19
 		$file = $base_dir.str_replace( '\\', '/', substr( $class, $len )).'.php';
18
-		if( !file_exists( $file ))continue;
20
+		if( !file_exists( $file )) {
21
+			continue;
22
+		}
19 23
 		require $file;
20 24
 		break;
21 25
 	}
Please login to merge, or discard this patch.
src/Profiler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	public function getMemoryString( $timer )
41 41
 	{
42 42
 		$timer = $this->normalize( $timer );
43
-		return sprintf( '%s kB', round( $timer['memory'] / 1000 ));
43
+		return sprintf( '%s kB', round( $timer[ 'memory' ] / 1000 ) );
44 44
 	}
45 45
 
46 46
 	/**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	public function getNameString( $timer )
51 51
 	{
52 52
 		$timer = $this->normalize( $timer );
53
-		return $timer['name'];
53
+		return $timer[ 'name' ];
54 54
 	}
55 55
 
56 56
 	/**
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	public function getTimeString( $timer )
61 61
 	{
62 62
 		$timer = $this->normalize( $timer );
63
-		$index = array_search( $timer['name'], array_column( $this->timers, 'name' ));
63
+		$index = array_search( $timer[ 'name' ], array_column( $this->timers, 'name' ) );
64 64
 		$start = $this->start + ( $index * $this->noise );
65
-		$time = number_format( round(( $timer['time'] - $start ) * 1000, 4 ), 4 );
65
+		$time = number_format( round( ( $timer[ 'time' ] - $start ) * 1000, 4 ), 4 );
66 66
 		return sprintf( '%s ms', $time );
67 67
 	}
68 68
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 			$this->noise = $microtime - $this->start;
90 90
 			return;
91 91
 		}
92
-		$this->timers[] = array(
92
+		$this->timers[ ] = array(
93 93
 			'memory' => memory_get_peak_usage(),
94 94
 			'name' => $name,
95 95
 			'time' => $microtime,
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function normalize( $timer )
105 105
 	{
106
-		return wp_parse_args( (array)$timer, array(
106
+		return wp_parse_args( (array) $timer, array(
107 107
 			'memory' => 0,
108 108
 			'name' => '',
109 109
 			'time' => 0,
110
-		));
110
+		) );
111 111
 	}
112 112
 }
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,7 +1,7 @@
 block discarded – undo
1 1
 <?php defined( 'WPINC' ) || die; ?>
2 2
 
3
-<pre><code class="php">$_GET = <?= esc_html( var_export( $_GET, true )); ?>;</code></pre><br/>
4
-<pre><code class="php">$_POST = <?= esc_html( var_export( $_POST, true )); ?>;</code></pre><br/>
5
-<pre><code class="php">$_COOKIE = <?= esc_html( var_export( $_COOKIE, true )); ?>;</code></pre><br/>
6
-<pre><code class="php">$_SESSION = <?= esc_html( var_export( isset( $_SESSION ) ? $_SESSION : [], true )); ?>;</code></pre><br/>
7
-<pre><code class="php">$_SERVER = <?= esc_html( var_export( $_SERVER, true )); ?>;</code></pre><br/>
3
+<pre><code class="php">$_GET = <?= esc_html( var_export( $_GET, true ) ); ?>;</code></pre><br/>
4
+<pre><code class="php">$_POST = <?= esc_html( var_export( $_POST, true ) ); ?>;</code></pre><br/>
5
+<pre><code class="php">$_COOKIE = <?= esc_html( var_export( $_COOKIE, true ) ); ?>;</code></pre><br/>
6
+<pre><code class="php">$_SESSION = <?= esc_html( var_export( isset( $_SESSION ) ? $_SESSION : [ ], true ) ); ?>;</code></pre><br/>
7
+<pre><code class="php">$_SERVER = <?= esc_html( var_export( $_SERVER, true ) ); ?>;</code></pre><br/>
Please login to merge, or discard this patch.
views/panels/console.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 <table>
4 4
 	<tbody>
5
-		<?php if( empty( $entries )) : ?>
5
+		<?php if( empty( $entries ) ) : ?>
6 6
 		<tr>
7 7
 			<td><?= __( 'No entries found.', 'blackbar' ); ?></td>
8 8
 		</tr>
9 9
 		<?php else : ?>
10 10
 		<?php foreach( $entries as $entry ) : ?>
11 11
 		<tr>
12
-			<td class="glbb-small"><?= $entry['name']; ?></td>
13
-			<td><pre><?= $entry['message']; ?></pre></td>
12
+			<td class="glbb-small"><?= $entry[ 'name' ]; ?></td>
13
+			<td><pre><?= $entry[ 'message' ]; ?></pre></td>
14 14
 		</tr>
15 15
 		<?php endforeach; ?>
16 16
 		<?php endif; ?>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,13 @@
 block discarded – undo
6 6
 		<tr>
7 7
 			<td><?= __( 'No entries found.', 'blackbar' ); ?></td>
8 8
 		</tr>
9
-		<?php else : ?>
9
+		<?php else {
10
+	: ?>
10 11
 		<?php foreach( $entries as $entry ) : ?>
11 12
 		<tr>
12
-			<td class="glbb-small"><?= $entry['name']; ?></td>
13
+			<td class="glbb-small"><?= $entry['name'];
14
+}
15
+?></td>
13 16
 			<td><pre><?= $entry['message']; ?></pre></td>
14 17
 		</tr>
15 18
 		<?php endforeach; ?>
Please login to merge, or discard this patch.
views/panels/profiler.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 <table>
4 4
 	<tbody>
5
-		<?php if( empty( $profiler->getMeasure() )) : ?>
5
+		<?php if( empty( $profiler->getMeasure() ) ) : ?>
6 6
 		<tr>
7 7
 			<td><?= __( 'No entries found.', 'blackbar' ); ?></td>
8 8
 		</tr>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,13 @@
 block discarded – undo
6 6
 		<tr>
7 7
 			<td><?= __( 'No entries found.', 'blackbar' ); ?></td>
8 8
 		</tr>
9
-		<?php else : ?>
9
+		<?php else {
10
+	: ?>
10 11
 		<?php foreach( $profiler->getMeasure() as $timer ) : ?>
11 12
 		<tr>
12
-			<td><?= $profiler->getNameString( $timer ); ?></td>
13
+			<td><?= $profiler->getNameString( $timer );
14
+}
15
+?></td>
13 16
 			<td class="glbb-medium"><?= $profiler->getTimeString( $timer ); ?></td>
14 17
 			<td class="glbb-medium"><?= $profiler->getMemoryString( $timer ); ?></td>
15 18
 		</tr>
Please login to merge, or discard this patch.
compatibility.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @see https://docs.gravityforms.com/gform_noconflict_scripts/
8 8
  */
9 9
 add_filter( 'gform_noconflict_scripts', function( array $scripts ) {
10
-	$scripts[] = 'blackbar';
10
+	$scripts[ ] = 'blackbar';
11 11
 	return $scripts;
12 12
 });
13 13
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @see https://docs.gravityforms.com/gform_noconflict_styles/
17 17
  */
18 18
 add_filter( 'gform_noconflict_styles', function( array $styles ) {
19
-	$styles[] = 'blackbar';
20
-	$styles[] = 'blackbar-syntax';
19
+	$styles[ ] = 'blackbar';
20
+	$styles[ ] = 'blackbar-syntax';
21 21
 	return $styles;
22 22
 });
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,8 @@  discard block
 block discarded – undo
6 6
  * @return array
7 7
  * @see https://docs.gravityforms.com/gform_noconflict_scripts/
8 8
  */
9
-add_filter( 'gform_noconflict_scripts', function( array $scripts ) {
9
+add_filter( 'gform_noconflict_scripts', function( array $scripts )
10
+{
10 11
 	$scripts[] = 'blackbar';
11 12
 	return $scripts;
12 13
 });
@@ -15,7 +16,8 @@  discard block
 block discarded – undo
15 16
  * @return array
16 17
  * @see https://docs.gravityforms.com/gform_noconflict_styles/
17 18
  */
18
-add_filter( 'gform_noconflict_styles', function( array $styles ) {
19
+add_filter( 'gform_noconflict_styles', function( array $styles )
20
+{
19 21
 	$styles[] = 'blackbar';
20 22
 	$styles[] = 'blackbar-syntax';
21 23
 	return $styles;
Please login to merge, or discard this patch.
activate.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		$this->versions = wp_parse_args( $versions, array(
31 31
 			'php' => static::MIN_PHP_VERSION,
32 32
 			'wordpress' => static::MIN_WORDPRESS_VERSION,
33
-		));
33
+		) );
34 34
 	}
35 35
 
36 36
 	/**
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 		if( $this->isValid() ) {
42 42
 			return true;
43 43
 		}
44
-		add_action( 'activated_plugin', array( $this, 'deactivate' ));
45
-		add_action( 'admin_notices', array( $this, 'deactivate' ));
44
+		add_action( 'activated_plugin', array( $this, 'deactivate' ) );
45
+		add_action( 'admin_notices', array( $this, 'deactivate' ) );
46 46
 		return false;
47 47
 	}
48 48
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function isPhpValid()
53 53
 	{
54
-		return !version_compare( PHP_VERSION, $this->versions['php'], '<' );
54
+		return !version_compare( PHP_VERSION, $this->versions[ 'php' ], '<' );
55 55
 	}
56 56
 
57 57
 	/**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	public function isWpValid()
69 69
 	{
70 70
 		global $wp_version;
71
-		return !version_compare( $wp_version, $this->versions['wordpress'], '<' );
71
+		return !version_compare( $wp_version, $this->versions[ 'wordpress' ], '<' );
72 72
 	}
73 73
 
74 74
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 		$pluginData = get_file_data( $this->file, array( 'name' => 'Plugin Name' ), 'plugin' );
86 86
 		deactivate_plugins( $pluginSlug );
87
-		$this->printNotice( $pluginData['name'] );
87
+		$this->printNotice( $pluginData[ 'name' ] );
88 88
 	}
89 89
 
90 90
 	/**
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
 	{
112 112
 		$noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>';
113 113
 		$messages = $this->getMessages();
114
-		$rollbackMessage = sprintf( '<strong>'.$messages[6].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName );
114
+		$rollbackMessage = sprintf( '<strong>' . $messages[ 6 ] . '</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName );
115 115
 		if( !$this->isPhpValid() ) {
116 116
 			printf( $noticeTemplate,
117
-				sprintf( $messages[0], $pluginName ),
118
-				sprintf( $messages[1], $messages[3].' '.$this->versions['php'] ),
119
-				sprintf( $messages[2], PHP_VERSION ).'</p><p>'.$rollbackMessage
117
+				sprintf( $messages[ 0 ], $pluginName ),
118
+				sprintf( $messages[ 1 ], $messages[ 3 ] . ' ' . $this->versions[ 'php' ] ),
119
+				sprintf( $messages[ 2 ], PHP_VERSION ) . '</p><p>' . $rollbackMessage
120 120
 			);
121 121
 		}
122 122
 		else if( !$this->isWpValid() ) {
123 123
 			printf( $noticeTemplate,
124
-				sprintf( $messages[0], $pluginName ),
125
-				sprintf( $messages[1], $messages[4].' '.$this->versions['wordpress'] ),
126
-				$rollbackMessage.'</p><p>'.sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] )
124
+				sprintf( $messages[ 0 ], $pluginName ),
125
+				sprintf( $messages[ 1 ], $messages[ 4 ] . ' ' . $this->versions[ 'wordpress' ] ),
126
+				$rollbackMessage . '</p><p>' . sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[ 5 ] )
127 127
 			);
128 128
 		}
129 129
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			filter_input( INPUT_GET, 'plugin_status' ),
138 138
 			filter_input( INPUT_GET, 'paged' ),
139 139
 			filter_input( INPUT_GET, 's' )
140
-		)));
140
+		) ) );
141 141
 		exit;
142 142
 	}
143 143
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,9 @@
 block discarded – undo
77 77
 	 */
78 78
 	public function deactivate( $plugin )
79 79
 	{
80
-		if( $this->isValid() )return;
80
+		if( $this->isValid() ) {
81
+			return;
82
+		}
81 83
 		$pluginSlug = plugin_basename( $this->file );
82 84
 		if( $plugin == $pluginSlug ) {
83 85
 			$this->redirect(); //exit
Please login to merge, or discard this patch.