@@ -40,7 +40,7 @@ discard block |
||
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 |
||
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 |
||
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 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->noise = $microtime - $this->start; |
89 | 89 | return; |
90 | 90 | } |
91 | - $this->timers[] = array( |
|
91 | + $this->timers[ ] = array( |
|
92 | 92 | 'memory' => memory_get_peak_usage(), |
93 | 93 | 'name' => $name, |
94 | 94 | 'time' => $microtime, |
@@ -105,6 +105,6 @@ discard block |
||
105 | 105 | 'memory' => 0, |
106 | 106 | 'name' => '', |
107 | 107 | 'time' => 0, |
108 | - )); |
|
108 | + ) ); |
|
109 | 109 | } |
110 | 110 | } |
@@ -23,9 +23,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,7 +140,7 @@ discard block |
||
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 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $warnings = $warningCount > 0 |
149 | 149 | ? sprintf( ', %d!', $warningCount ) |
150 | 150 | : ''; |
151 | - return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount.$warnings ); |
|
151 | + return sprintf( __( 'Errors (%s)', 'blackbar' ), $errorCount . $warnings ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $files = array_values( array_filter( get_included_files(), function( $file ) { |
160 | 160 | $bool = strpos( $file, '/themes/' ) !== false |
161 | 161 | && strpos( $file, '/functions.php' ) === false; |
162 | - return (bool)apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
163 | - })); |
|
162 | + return (bool) apply_filters( 'blackbar/templates/file', $bool, $file ); |
|
163 | + }) ); |
|
164 | 164 | return array_map( function( $key, $value ) { |
165 | 165 | $value = str_replace( trailingslashit( WP_CONTENT_DIR ), '', $value ); |
166 | 166 | return sprintf( '[%s] => %s', $key, $value ); |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | 'ORDER BY', 'SET', 'WHERE', |
189 | 189 | ); |
190 | 190 | $replace = array_map( function( $value ) { |
191 | - return PHP_EOL.$value; |
|
191 | + return PHP_EOL . $value; |
|
192 | 192 | }, $search ); |
193 | 193 | foreach( $wpdb->queries as $query ) { |
194 | - $miliseconds = number_format( round( $query[1] * 1000, 4 ), 4 ); |
|
195 | - $sql = preg_replace( '/\s\s+/', ' ', trim( $query[0] )); |
|
194 | + $miliseconds = number_format( round( $query[ 1 ] * 1000, 4 ), 4 ); |
|
195 | + $sql = preg_replace( '/\s\s+/', ' ', trim( $query[ 0 ] ) ); |
|
196 | 196 | $sql = str_replace( PHP_EOL, ' ', $sql ); |
197 | 197 | $sql = str_replace( $search, $replace, $sql ); |
198 | - $queries[] = array( |
|
198 | + $queries[ ] = array( |
|
199 | 199 | 'ms' => $miliseconds, |
200 | 200 | 'sql' => $sql, |
201 | 201 | ); |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | global $wpdb; |
215 | 215 | $queryTime = 0; |
216 | 216 | foreach( $wpdb->queries as $query ) { |
217 | - $queryTime += $query[1]; |
|
217 | + $queryTime += $query[ 1 ]; |
|
218 | 218 | } |
219 | - $queriesCount = '<span class="glbb-queries-count">'.count( $wpdb->queries ).'</span>'; |
|
220 | - $queriesTime = '<span class="glbb-queries-time">'.$this->convertToMiliseconds( $queryTime ).'</span>'; |
|
219 | + $queriesCount = '<span class="glbb-queries-count">' . count( $wpdb->queries ) . '</span>'; |
|
220 | + $queriesTime = '<span class="glbb-queries-time">' . $this->convertToMiliseconds( $queryTime ) . '</span>'; |
|
221 | 221 | return sprintf( __( 'SQL (%s queries in %s ms)', 'blackbar' ), $queriesCount, $queriesTime ); |
222 | 222 | } |
223 | 223 | |
@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | protected function getTemplates() |
228 | 228 | { |
229 | 229 | if( is_admin() )return; |
230 | - if( class_exists( '\GeminiLabs\Castor\Facades\Development' )) { |
|
230 | + if( class_exists( '\GeminiLabs\Castor\Facades\Development' ) ) { |
|
231 | 231 | ob_start(); |
232 | 232 | \GeminiLabs\Castor\Facades\Development::printTemplatePaths(); |
233 | 233 | return ob_get_clean(); |
234 | 234 | } |
235 | - return '<pre>'.implode( PHP_EOL, $this->getIncludedFiles() ).'</pre>'; |
|
235 | + return '<pre>' . implode( PHP_EOL, $this->getIncludedFiles() ) . '</pre>'; |
|
236 | 236 | } |
237 | 237 | } |