@@ -32,8 +32,8 @@ |
||
32 | 32 | /** |
33 | 33 | * Get Test Files |
34 | 34 | * |
35 | - * @param null $directory |
|
36 | - * @param null $excludes |
|
35 | + * @param string|null $directory |
|
36 | + * @param string $excludes |
|
37 | 37 | * @return array |
38 | 38 | */ |
39 | 39 | public static function getTestFiles($directory = null, $excludes = null) { |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DebugKit Group Test Case |
|
4 | - * |
|
5 | - * PHP 5 |
|
6 | - * |
|
7 | - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
8 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
9 | - * |
|
10 | - * Licensed under The MIT License |
|
11 | - * Redistributions of files must retain the above copyright notice. |
|
12 | - * |
|
13 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
14 | - * @link http://cakephp.org CakePHP(tm) Project |
|
15 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
16 | - */ |
|
3 | + * DebugKit Group Test Case |
|
4 | + * |
|
5 | + * PHP 5 |
|
6 | + * |
|
7 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
8 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
9 | + * |
|
10 | + * Licensed under The MIT License |
|
11 | + * Redistributions of files must retain the above copyright notice. |
|
12 | + * |
|
13 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
14 | + * @link http://cakephp.org CakePHP(tm) Project |
|
15 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Class DebugKitGroupTestCase |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | if ($excludes !== null) { |
49 | - $excludes = self::getTestFiles((array)$excludes); |
|
49 | + $excludes = self::getTestFiles((array) $excludes); |
|
50 | 50 | } |
51 | 51 | if ($directory === null || $directory !== realpath($directory)) { |
52 | - $basePath = App::pluginPath('DebugKit') . 'Test' . DS . 'Case' . DS; |
|
53 | - $directory = str_replace(DS . DS, DS, $basePath . $directory); |
|
52 | + $basePath = App::pluginPath('DebugKit').'Test'.DS.'Case'.DS; |
|
53 | + $directory = str_replace(DS.DS, DS, $basePath.$directory); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | $files = array(); |
59 | 59 | while ($it->valid()) { |
60 | 60 | |
61 | - if (!$it->isDot()) { |
|
61 | + if ( ! $it->isDot()) { |
|
62 | 62 | $file = $it->key(); |
63 | 63 | |
64 | 64 | if ( |
65 | 65 | preg_match('|Test\.php$|', $file) && |
66 | 66 | $file !== __FILE__ && |
67 | - !preg_match('|^All.+?\.php$|', basename($file)) && |
|
68 | - ($excludes === null || !in_array($file, $excludes)) |
|
67 | + ! preg_match('|^All.+?\.php$|', basename($file)) && |
|
68 | + ($excludes === null || ! in_array($file, $excludes)) |
|
69 | 69 | ) { |
70 | 70 | $files[] = $file; |
71 | 71 | } |
@@ -149,7 +149,7 @@ |
||
149 | 149 | * |
150 | 150 | * @param mixed $cmd |
151 | 151 | * @param mixed $out null |
152 | - * @return boolean True if successful |
|
152 | + * @return string|boolean True if successful |
|
153 | 153 | */ |
154 | 154 | protected function _exec($cmd, &$out = null) { |
155 | 155 | if (DS === '/') { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function process($html = '', &$out = '') { |
49 | 49 | $errors = $this->tidyErrors($html, $out); |
50 | 50 | |
51 | - if (!$errors) { |
|
51 | + if ( ! $errors) { |
|
52 | 52 | return array(); |
53 | 53 | } |
54 | 54 | $result = array('Error' => array(), 'Warning' => array(), 'Misc' => array()); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (isset($markup[$line - 1])) { |
65 | 65 | $string .= h($markup[$line - 1]); |
66 | 66 | } |
67 | - $string .= '<strong>' . h(@$markup[$line]) . '</strong>'; |
|
67 | + $string .= '<strong>'.h(@$markup[$line]).'</strong>'; |
|
68 | 68 | if (isset($markup[$line + 1])) { |
69 | 69 | $string .= h($markup[$line + 1]); |
70 | 70 | } |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | } elseif ($this->results === null) { |
96 | 96 | $this->process($this->_View->output); |
97 | 97 | } |
98 | - if (!$this->results) { |
|
99 | - return '<p>' . __d('debug_kit', 'No markup errors found') . '</p>'; |
|
98 | + if ( ! $this->results) { |
|
99 | + return '<p>'.__d('debug_kit', 'No markup errors found').'</p>'; |
|
100 | 100 | } |
101 | 101 | foreach ($this->results as &$results) { |
102 | 102 | foreach ($results as $type => &$messages) { |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | if (function_exists('tidy_parse_string')) { |
124 | 124 | $tidy = tidy_parse_string($out, array(), 'UTF8'); |
125 | 125 | $tidy->cleanRepair(); |
126 | - $errors = $tidy->errorBuffer . "\n"; |
|
126 | + $errors = $tidy->errorBuffer."\n"; |
|
127 | 127 | return $errors; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // cli |
131 | - $File = new File(rtrim(TMP, DS) . DS . rand() . '.html', true); |
|
131 | + $File = new File(rtrim(TMP, DS).DS.rand().'.html', true); |
|
132 | 132 | $File->write($out); |
133 | 133 | $path = $File->pwd(); |
134 | - $errors = $path . '.err'; |
|
134 | + $errors = $path.'.err'; |
|
135 | 135 | $this->_exec("tidy -eq -utf8 -f $errors $path"); |
136 | 136 | $File->delete(); |
137 | 137 | |
138 | - if (!file_exists($errors)) { |
|
138 | + if ( ! file_exists($errors)) { |
|
139 | 139 | return ''; |
140 | 140 | } |
141 | 141 | $Error = new File($errors); |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function _exec($cmd, &$out = null) { |
155 | 155 | if (DS === '/') { |
156 | - $_out = exec($cmd . ' 2>&1', $out, $return); |
|
156 | + $_out = exec($cmd.' 2>&1', $out, $return); |
|
157 | 157 | } else { |
158 | 158 | $_out = exec($cmd, $out, $return); |
159 | 159 | } |
160 | 160 | |
161 | 161 | if (Configure::read('debug')) { |
162 | - $source = Debugger::trace(array('depth' => 1, 'start' => 2)) . "\n"; |
|
162 | + $source = Debugger::trace(array('depth' => 1, 'start' => 2))."\n"; |
|
163 | 163 | //CakeLog::write('system_calls_' . date('Y-m-d'), "\n" . $source . Debugger::exportVar(compact('cmd','out','return'))); |
164 | 164 | //CakeLog::write('system_calls', "\n" . $source . Debugger::exportVar(compact('cmd','out','return'))); |
165 | 165 | } |
@@ -133,7 +133,7 @@ |
||
133 | 133 | * |
134 | 134 | * @param string $name Name of the panel you want cached data for |
135 | 135 | * @param integer $index |
136 | - * @return mixed Boolean false on failure, array of data otherwise. |
|
136 | + * @return boolean|string Boolean false on failure, array of data otherwise. |
|
137 | 137 | */ |
138 | 138 | public function readCache($name, $index = 0) { |
139 | 139 | if (!$this->_cacheEnabled) { |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
4 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
5 | - * |
|
6 | - * Licensed under The MIT License |
|
7 | - * Redistributions of files must retain the above copyright notice. |
|
8 | - * |
|
9 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
10 | - * @link http://cakephp.org CakePHP(tm) Project |
|
11 | - * @since DebugKit 0.1 |
|
12 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
13 | - */ |
|
3 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
4 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
5 | + * |
|
6 | + * Licensed under The MIT License |
|
7 | + * Redistributions of files must retain the above copyright notice. |
|
8 | + * |
|
9 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
10 | + * @link http://cakephp.org CakePHP(tm) Project |
|
11 | + * @since DebugKit 0.1 |
|
12 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | App::uses('DebugKitDebugger', 'DebugKit.Lib'); |
16 | 16 | App::uses('AppHelper', 'View/Helper'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return; |
55 | 55 | } |
56 | 56 | |
57 | - if (!isset($options['output'])) { |
|
57 | + if ( ! isset($options['output'])) { |
|
58 | 58 | $options['output'] = 'DebugKit.HtmlToolbar'; |
59 | 59 | } |
60 | 60 | $className = $options['output']; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public function afterLayout($layoutFile) { |
82 | - if (!$this->request->is('requested')) { |
|
82 | + if ( ! $this->request->is('requested')) { |
|
83 | 83 | $this->send(); |
84 | 84 | } |
85 | 85 | } |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * @return boolean Success of write. |
121 | 121 | */ |
122 | 122 | public function writeCache($name, $content) { |
123 | - if (!$this->_cacheEnabled) { |
|
123 | + if ( ! $this->_cacheEnabled) { |
|
124 | 124 | return false; |
125 | 125 | } |
126 | - $existing = (array)Cache::read($this->_cacheKey, $this->_cacheConfig); |
|
126 | + $existing = (array) Cache::read($this->_cacheKey, $this->_cacheConfig); |
|
127 | 127 | $existing[0][$name]['content'] = $content; |
128 | 128 | return Cache::write($this->_cacheKey, $existing, $this->_cacheConfig); |
129 | 129 | } |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * @return mixed Boolean false on failure, array of data otherwise. |
137 | 137 | */ |
138 | 138 | public function readCache($name, $index = 0) { |
139 | - if (!$this->_cacheEnabled) { |
|
139 | + if ( ! $this->_cacheEnabled) { |
|
140 | 140 | return false; |
141 | 141 | } |
142 | - $existing = (array)Cache::read($this->_cacheKey, $this->_cacheConfig); |
|
143 | - if (!isset($existing[$index][$name]['content'])) { |
|
142 | + $existing = (array) Cache::read($this->_cacheKey, $this->_cacheConfig); |
|
143 | + if ( ! isset($existing[$index][$name]['content'])) { |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | return $existing[$index][$name]['content']; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $options += array('explain' => false, 'cache' => true, 'threshold' => 20); |
165 | 165 | $db = ConnectionManager::getDataSource($connection); |
166 | 166 | |
167 | - if (!method_exists($db, 'getLog')) { |
|
167 | + if ( ! method_exists($db, 'getLog')) { |
|
168 | 168 | return array(); |
169 | 169 | } |
170 | 170 | |
@@ -197,19 +197,19 @@ discard block |
||
197 | 197 | } |
198 | 198 | if ($isHtml) { |
199 | 199 | $query['query'] = h($query['query']); |
200 | - if (!empty($query['params']) && is_array($query['params'])) { |
|
200 | + if ( ! empty($query['params']) && is_array($query['params'])) { |
|
201 | 201 | $bindParam = $bindType = null; |
202 | 202 | if (preg_match('/.+ :.+/', $query['query'])) { |
203 | 203 | $bindType = true; |
204 | 204 | } |
205 | 205 | foreach ($query['params'] as $bindKey => $bindVal) { |
206 | 206 | if ($bindType === true) { |
207 | - $bindParam .= h($bindKey) . " => " . h($bindVal) . ", "; |
|
207 | + $bindParam .= h($bindKey)." => ".h($bindVal).", "; |
|
208 | 208 | } else { |
209 | - $bindParam .= h($bindVal) . ", "; |
|
209 | + $bindParam .= h($bindVal).", "; |
|
210 | 210 | } |
211 | 211 | } |
212 | - $query['query'] .= " [ " . rtrim($bindParam, ', ') . " ]"; |
|
212 | + $query['query'] .= " [ ".rtrim($bindParam, ', ')." ]"; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | unset($query['params']); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | public function getOptionParser() { |
133 | 133 | $parser = parent::getOptionParser(); |
134 | 134 | $parser->description(__d('debug_kit', |
135 | - 'Allows you to obtain some rough benchmarking statistics' . |
|
135 | + 'Allows you to obtain some rough benchmarking statistics'. |
|
136 | 136 | 'about a fully qualified URL.' |
137 | 137 | )) |
138 | 138 | ->addArgument('url', array( |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | )) |
146 | 146 | ->addOption('t', array( |
147 | 147 | 'default' => 100, |
148 | - 'help' => __d('debug_kit', 'Maximum total time for all iterations, in seconds.' . |
|
148 | + 'help' => __d('debug_kit', 'Maximum total time for all iterations, in seconds.'. |
|
149 | 149 | 'If a single iteration takes more than the timeout, only one request will be made' |
150 | 150 | ) |
151 | 151 | )) |
152 | 152 | ->epilog(__d('debug_kit', |
153 | - 'Example Use: `cake benchmark --n 10 --t 100 http://localhost/testsite`. ' . |
|
153 | + 'Example Use: `cake benchmark --n 10 --t 100 http://localhost/testsite`. '. |
|
154 | 154 | '<info>Note:</info> this benchmark does not include browser render times.' |
155 | 155 | )); |
156 | 156 | return $parser; |
@@ -30,22 +30,22 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function main() { |
32 | 32 | $path = APP; |
33 | - if (!empty($this->params['path']) && strpos($this->params['path'], '/') === 0) { |
|
33 | + if ( ! empty($this->params['path']) && strpos($this->params['path'], '/') === 0) { |
|
34 | 34 | $path = $this->params['path']; |
35 | - } elseif (!empty($this->params['path'])) { |
|
35 | + } elseif ( ! empty($this->params['path'])) { |
|
36 | 36 | $path .= $this->params['path']; |
37 | 37 | } |
38 | 38 | $folder = new Folder($path); |
39 | 39 | |
40 | 40 | $r = $folder->findRecursive('.*\.php'); |
41 | - $this->out("Checking *.php in " . $path); |
|
41 | + $this->out("Checking *.php in ".$path); |
|
42 | 42 | foreach ($r as $file) { |
43 | 43 | $c = file_get_contents($file); |
44 | 44 | if (preg_match('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', $c)) { |
45 | - $this->out('!!!contains leading whitespaces: ' . $this->shortPath($file)); |
|
45 | + $this->out('!!!contains leading whitespaces: '.$this->shortPath($file)); |
|
46 | 46 | } |
47 | 47 | if (preg_match('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', $c)) { |
48 | - $this->out('!!!contains trailing whitespaces: ' . $this->shortPath($file)); |
|
48 | + $this->out('!!!contains trailing whitespaces: '.$this->shortPath($file)); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function trim() { |
60 | 60 | $path = APP; |
61 | - if (!empty($this->params['path']) && strpos($this->params['path'], '/') === 0) { |
|
61 | + if ( ! empty($this->params['path']) && strpos($this->params['path'], '/') === 0) { |
|
62 | 62 | $path = $this->params['path']; |
63 | - } elseif (!empty($this->params['path'])) { |
|
63 | + } elseif ( ! empty($this->params['path'])) { |
|
64 | 64 | $path .= $this->params['path']; |
65 | 65 | } |
66 | 66 | $folder = new Folder($path); |
67 | 67 | |
68 | 68 | $r = $folder->findRecursive('.*\.php'); |
69 | - $this->out("Checking *.php in " . $path); |
|
69 | + $this->out("Checking *.php in ".$path); |
|
70 | 70 | foreach ($r as $file) { |
71 | 71 | $c = file_get_contents($file); |
72 | 72 | if (preg_match('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', $c) || preg_match('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', $c)) { |
73 | - $this->out('trimming' . $this->shortPath($file)); |
|
73 | + $this->out('trimming'.$this->shortPath($file)); |
|
74 | 74 | $c = preg_replace('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', '<?php', $c); |
75 | 75 | $c = preg_replace('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', '?>', $c); |
76 | 76 | file_put_contents($file, $c); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function sql_explain() { |
104 | 104 | if ( |
105 | - !$this->request->is('post') || |
|
105 | + ! $this->request->is('post') || |
|
106 | 106 | empty($this->request->data['log']['sql']) || |
107 | 107 | empty($this->request->data['log']['ds']) || |
108 | 108 | empty($this->request->data['log']['hash']) || |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ) { |
111 | 111 | throw new BadRequestException('Invalid parameters'); |
112 | 112 | } |
113 | - $hash = Security::hash($this->request->data['log']['sql'] . $this->request->data['log']['ds'], 'sha1', true); |
|
113 | + $hash = Security::hash($this->request->data['log']['sql'].$this->request->data['log']['ds'], 'sha1', true); |
|
114 | 114 | if ($hash !== $this->request->data['log']['hash']) { |
115 | 115 | throw new BadRequestException('Invalid parameters'); |
116 | 116 | } |
@@ -208,7 +208,7 @@ |
||
208 | 208 | * @return void |
209 | 209 | */ |
210 | 210 | public static function fireError($data, $links) { |
211 | - $name = $data['error'] . ' - ' . $data['description']; |
|
211 | + $name = $data['error'].' - '.$data['description']; |
|
212 | 212 | $message = "{$data['error']} {$data['code']} {$data['description']} on line: {$data['line']} in file: {$data['file']}"; |
213 | 213 | FireCake::group($name); |
214 | 214 | FireCake::error($message, $name); |
@@ -55,17 +55,17 @@ |
||
55 | 55 | */ |
56 | 56 | public static function record($message = null) { |
57 | 57 | $memoryUse = self::getCurrent(); |
58 | - if (!$message) { |
|
58 | + if ( ! $message) { |
|
59 | 59 | $named = false; |
60 | 60 | $trace = debug_backtrace(); |
61 | - $message = Debugger::trimpath($trace[0]['file']) . ' line ' . $trace[0]['line']; |
|
61 | + $message = Debugger::trimpath($trace[0]['file']).' line '.$trace[0]['line']; |
|
62 | 62 | } |
63 | 63 | if (isset(self::$_points[$message])) { |
64 | 64 | $originalMessage = $message; |
65 | 65 | $i = 1; |
66 | 66 | while (isset(self::$_points[$message])) { |
67 | 67 | $i++; |
68 | - $message = $originalMessage . ' #' . $i; |
|
68 | + $message = $originalMessage.' #'.$i; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | self::$_points[$message] = $memoryUse; |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
4 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
5 | - * |
|
6 | - * Licensed under The MIT License |
|
7 | - * Redistributions of files must retain the above copyright notice. |
|
8 | - * |
|
9 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
10 | - * @link http://cakephp.org CakePHP(tm) Project |
|
11 | - * @since DebugKit 0.1 |
|
12 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
13 | - */ |
|
3 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
|
4 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
5 | + * |
|
6 | + * Licensed under The MIT License |
|
7 | + * Redistributions of files must retain the above copyright notice. |
|
8 | + * |
|
9 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
10 | + * @link http://cakephp.org CakePHP(tm) Project |
|
11 | + * @since DebugKit 0.1 |
|
12 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | App::uses('Debugger', 'Utility'); |
16 | 16 |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | public static function start($name = null, $message = null) { |
38 | 38 | $start = microtime(true); |
39 | 39 | |
40 | - if (!$name) { |
|
40 | + if ( ! $name) { |
|
41 | 41 | $named = false; |
42 | 42 | $calledFrom = debug_backtrace(); |
43 | - $_name = $name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line']; |
|
43 | + $_name = $name = Debugger::trimpath($calledFrom[0]['file']).' line '.$calledFrom[0]['line']; |
|
44 | 44 | } else { |
45 | 45 | $named = true; |
46 | 46 | } |
47 | 47 | |
48 | - if (!$message) { |
|
48 | + if ( ! $message) { |
|
49 | 49 | $message = $name; |
50 | 50 | } |
51 | 51 | |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | $i = 1; |
54 | 54 | while (isset(self::$_timers[$name])) { |
55 | 55 | $i++; |
56 | - $name = $_name . ' #' . $i; |
|
56 | + $name = $_name.' #'.$i; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if ($i > 1) { |
60 | - $message .= ' #' . $i; |
|
60 | + $message .= ' #'.$i; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | self::$_timers[$name] = array( |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function stop($name = null) { |
80 | 80 | $end = microtime(true); |
81 | - if (!$name) { |
|
81 | + if ( ! $name) { |
|
82 | 82 | $names = array_reverse(array_keys(self::$_timers)); |
83 | 83 | foreach ($names as $name) { |
84 | - if (!empty(self::$_timers[$name]['end'])) { |
|
84 | + if ( ! empty(self::$_timers[$name]['end'])) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | if (empty(self::$_timers[$name]['named'])) { |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | break; |
97 | 97 | } |
98 | 98 | $i++; |
99 | - $name = $_name . ' #' . $i; |
|
99 | + $name = $_name.' #'.$i; |
|
100 | 100 | } |
101 | 101 | } |
102 | - if (!isset(self::$_timers[$name])) { |
|
102 | + if ( ! isset(self::$_timers[$name])) { |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | self::$_timers[$name]['end'] = $end; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $now = microtime(true); |
119 | 119 | |
120 | 120 | $times = array(); |
121 | - if (!empty(self::$_timers)) { |
|
121 | + if ( ! empty(self::$_timers)) { |
|
122 | 122 | $firstTimer = reset(self::$_timers); |
123 | 123 | $_end = $firstTimer['start']; |
124 | 124 | } else { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | 'named' => null |
133 | 133 | ); |
134 | 134 | foreach (self::$_timers as $name => $timer) { |
135 | - if (!isset($timer['end'])) { |
|
135 | + if ( ! isset($timer['end'])) { |
|
136 | 136 | $timer['end'] = $now; |
137 | 137 | } |
138 | 138 | $times[$name] = array_merge($timer, array( |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @return float number of seconds elapsed for timer name, 0 on missing key |
166 | 166 | */ |
167 | 167 | public static function elapsedTime($name = 'default', $precision = 5) { |
168 | - if (!isset(self::$_timers[$name]['start']) || !isset(self::$_timers[$name]['end'])) { |
|
168 | + if ( ! isset(self::$_timers[$name]['start']) || ! isset(self::$_timers[$name]['end'])) { |
|
169 | 169 | return 0; |
170 | 170 | } |
171 | 171 | return round(self::$_timers[$name]['end'] - self::$_timers[$name]['start'], $precision); |