@@ -189,7 +189,7 @@ |
||
189 | 189 | * Encode a string into JSON. Converts and escapes necessary characters. |
190 | 190 | * |
191 | 191 | * @param string $string The string that needs to be utf8->hex encoded |
192 | - * @return void |
|
192 | + * @return string |
|
193 | 193 | */ |
194 | 194 | protected function _utf8ToHex($string) { |
195 | 195 | $length = strlen($string); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return string completed alert() |
64 | 64 | */ |
65 | 65 | public function alert($message) { |
66 | - return 'alert("' . $this->escape($message) . '");'; |
|
66 | + return 'alert("'.$this->escape($message).'");'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string completed redirect in javascript |
75 | 75 | */ |
76 | 76 | public function redirect($url = null) { |
77 | - return 'window.location = "' . Router::url($url) . '";'; |
|
77 | + return 'window.location = "'.Router::url($url).'";'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return string completed confirm() |
85 | 85 | */ |
86 | 86 | public function confirm($message) { |
87 | - return 'confirm("' . $this->escape($message) . '");'; |
|
87 | + return 'confirm("'.$this->escape($message).'");'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return string completed confirm with return script |
96 | 96 | */ |
97 | 97 | public function confirmReturn($message) { |
98 | - $out = 'var _confirm = ' . $this->confirm($message); |
|
98 | + $out = 'var _confirm = '.$this->confirm($message); |
|
99 | 99 | $out .= "if (!_confirm) {\n\treturn false;\n}"; |
100 | 100 | return $out; |
101 | 101 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return string completed prompt() |
109 | 109 | */ |
110 | 110 | public function prompt($message, $default = '') { |
111 | - return 'prompt("' . $this->escape($message) . '", "' . $this->escape($default) . '");'; |
|
111 | + return 'prompt("'.$this->escape($message).'", "'.$this->escape($default).'");'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | ); |
131 | 131 | $options = array_merge($defaultOptions, $options); |
132 | 132 | |
133 | - return $options['prefix'] . json_encode($data) . $options['postfix']; |
|
133 | + return $options['prefix'].json_encode($data).$options['postfix']; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | default: |
164 | 164 | $val = $this->escape($val); |
165 | 165 | if ($quoteString) { |
166 | - $val = '"' . $val . '"'; |
|
166 | + $val = '"'.$val.'"'; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | return $val; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | case $ord == 0x22: |
216 | 216 | case $ord == 0x2F: |
217 | 217 | case $ord == 0x5C: |
218 | - $return .= '\\' . $string{$i}; |
|
218 | + $return .= '\\'.$string{$i}; |
|
219 | 219 | break; |
220 | 220 | case (($ord >= 0x20) && ($ord <= 0x7F)): |
221 | 221 | $return .= $string{$i}; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $return .= '?'; |
227 | 227 | break; |
228 | 228 | } |
229 | - $charbits = $string{$i} . $string{$i + 1}; |
|
229 | + $charbits = $string{$i}.$string{$i + 1}; |
|
230 | 230 | $char = Multibyte::utf8($charbits); |
231 | 231 | $return .= sprintf('\u%04s', dechex($char[0])); |
232 | 232 | $i += 1; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $return .= '?'; |
238 | 238 | break; |
239 | 239 | } |
240 | - $charbits = $string{$i} . $string{$i + 1} . $string{$i + 2}; |
|
240 | + $charbits = $string{$i}.$string{$i + 1}.$string{$i + 2}; |
|
241 | 241 | $char = Multibyte::utf8($charbits); |
242 | 242 | $return .= sprintf('\u%04s', dechex($char[0])); |
243 | 243 | $i += 2; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $return .= '?'; |
249 | 249 | break; |
250 | 250 | } |
251 | - $charbits = $string{$i} . $string{$i + 1} . $string{$i + 2} . $string{$i + 3}; |
|
251 | + $charbits = $string{$i}.$string{$i + 1}.$string{$i + 2}.$string{$i + 3}; |
|
252 | 252 | $char = Multibyte::utf8($charbits); |
253 | 253 | $return .= sprintf('\u%04s', dechex($char[0])); |
254 | 254 | $i += 3; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $return .= '?'; |
260 | 260 | break; |
261 | 261 | } |
262 | - $charbits = $string{$i} . $string{$i + 1} . $string{$i + 2} . $string{$i + 3} . $string{$i + 4}; |
|
262 | + $charbits = $string{$i}.$string{$i + 1}.$string{$i + 2}.$string{$i + 3}.$string{$i + 4}; |
|
263 | 263 | $char = Multibyte::utf8($charbits); |
264 | 264 | $return .= sprintf('\u%04s', dechex($char[0])); |
265 | 265 | $i += 4; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $return .= '?'; |
271 | 271 | break; |
272 | 272 | } |
273 | - $charbits = $string{$i} . $string{$i + 1} . $string{$i + 2} . $string{$i + 3} . $string{$i + 4} . $string{$i + 5}; |
|
273 | + $charbits = $string{$i}.$string{$i + 1}.$string{$i + 2}.$string{$i + 3}.$string{$i + 4}.$string{$i + 5}; |
|
274 | 274 | $char = Multibyte::utf8($charbits); |
275 | 275 | $return .= sprintf('\u%04s', dechex($char[0])); |
276 | 276 | $i += 5; |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | $out = array(); |
488 | 488 | $safeKeys = array_flip($safeKeys); |
489 | 489 | foreach ($options as $key => $value) { |
490 | - if (!is_int($value) && !isset($safeKeys[$key])) { |
|
490 | + if ( ! is_int($value) && ! isset($safeKeys[$key])) { |
|
491 | 491 | $value = $this->value($value); |
492 | 492 | } |
493 | - $out[] = $key . ':' . $value; |
|
493 | + $out[] = $key.':'.$value; |
|
494 | 494 | } |
495 | 495 | sort($out); |
496 | 496 | return implode(', ', $out); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | * @return array Array of mapped options. |
506 | 506 | */ |
507 | 507 | protected function _mapOptions($method, $options) { |
508 | - if (!isset($this->_optionMap[$method])) { |
|
508 | + if ( ! isset($this->_optionMap[$method])) { |
|
509 | 509 | return $options; |
510 | 510 | } |
511 | 511 | foreach ($this->_optionMap[$method] as $abstract => $concrete) { |
@@ -532,24 +532,24 @@ discard block |
||
532 | 532 | $wrapCallbacks = $options['wrapCallbacks']; |
533 | 533 | } |
534 | 534 | unset($options['wrapCallbacks']); |
535 | - if (!$wrapCallbacks) { |
|
535 | + if ( ! $wrapCallbacks) { |
|
536 | 536 | return $options; |
537 | 537 | } |
538 | 538 | $callbackOptions = array(); |
539 | 539 | if (isset($this->_callbackArguments[$method])) { |
540 | 540 | $callbackOptions = $this->_callbackArguments[$method]; |
541 | 541 | } |
542 | - $callbacks = array_unique(array_merge(array_keys($callbackOptions), (array)$callbacks)); |
|
542 | + $callbacks = array_unique(array_merge(array_keys($callbackOptions), (array) $callbacks)); |
|
543 | 543 | |
544 | 544 | foreach ($callbacks as $callback) { |
545 | 545 | if (empty($options[$callback])) { |
546 | 546 | continue; |
547 | 547 | } |
548 | 548 | $args = null; |
549 | - if (!empty($callbackOptions[$callback])) { |
|
549 | + if ( ! empty($callbackOptions[$callback])) { |
|
550 | 550 | $args = $callbackOptions[$callback]; |
551 | 551 | } |
552 | - $options[$callback] = 'function (' . $args . ') {' . $options[$callback] . '}'; |
|
552 | + $options[$callback] = 'function ('.$args.') {'.$options[$callback].'}'; |
|
553 | 553 | } |
554 | 554 | return $options; |
555 | 555 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $keys = array_keys($parameters); |
581 | 581 | $count = count($parameters); |
582 | 582 | for ($i = 0; $i < $count; $i++) { |
583 | - $out .= $keys[$i] . '=' . $parameters[$keys[$i]]; |
|
583 | + $out .= $keys[$i].'='.$parameters[$keys[$i]]; |
|
584 | 584 | if ($i < $count - 1) { |
585 | 585 | $out .= '&'; |
586 | 586 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * - `safe` - if an inline block is generated should it be wrapped in <![CDATA[ ... ]]> (default true) |
185 | 185 | * |
186 | 186 | * @param array $options options for the code block |
187 | - * @return mixed Completed javascript tag if there are scripts, if there are no buffered |
|
187 | + * @return null|string Completed javascript tag if there are scripts, if there are no buffered |
|
188 | 188 | * scripts null will be returned. |
189 | 189 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::writeBuffer |
190 | 190 | */ |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @param string|array $one Either an array of variables to set, or the name of the variable to set. |
326 | 326 | * @param string|array $two If $one is a string, $two is the value for that key. |
327 | - * @return void |
|
327 | + * @return false|null |
|
328 | 328 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::set |
329 | 329 | */ |
330 | 330 | public function set($one, $two = null) { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * Extracted Html Options are removed from the $options param. |
411 | 411 | * |
412 | 412 | * @param array $options Options to filter. |
413 | - * @param array $additional Array of additional keys to extract and include in the return options array. |
|
413 | + * @param string[] $additional Array of additional keys to extract and include in the return options array. |
|
414 | 414 | * @return array Array of js options and Htmloptions |
415 | 415 | */ |
416 | 416 | protected function _getHtmlOptions($options, $additional = array()) { |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | $engineName = $className; |
93 | 93 | list(, $className) = pluginSplit($className); |
94 | 94 | |
95 | - $this->_engineName = $className . 'Engine'; |
|
96 | - $engineClass = $engineName . 'Engine'; |
|
95 | + $this->_engineName = $className.'Engine'; |
|
96 | + $engineClass = $engineName.'Engine'; |
|
97 | 97 | $this->helpers[] = $engineClass; |
98 | 98 | parent::__construct($View, $settings); |
99 | 99 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | } |
147 | 147 | return $out; |
148 | 148 | } |
149 | - if (method_exists($this, $method . '_')) { |
|
150 | - return call_user_func(array(&$this, $method . '_'), $params); |
|
149 | + if (method_exists($this, $method.'_')) { |
|
150 | + return call_user_func(array(&$this, $method.'_'), $params); |
|
151 | 151 | } |
152 | 152 | trigger_error(__d('cake_dev', 'JsHelper:: Missing Method %s is undefined', $method), E_USER_WARNING); |
153 | 153 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::writeBuffer |
190 | 190 | */ |
191 | 191 | public function writeBuffer($options = array()) { |
192 | - $domReady = !$this->request->is('ajax'); |
|
192 | + $domReady = ! $this->request->is('ajax'); |
|
193 | 193 | $defaults = array( |
194 | 194 | 'onDomReady' => $domReady, 'inline' => true, |
195 | 195 | 'cache' => false, 'clear' => true, 'safe' => true |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | |
210 | 210 | if ($options['cache'] && $options['inline']) { |
211 | 211 | $filename = md5($script); |
212 | - $path = WWW_ROOT . Configure::read('App.jsBaseUrl'); |
|
213 | - if (file_exists($path . $filename . '.js') |
|
214 | - || cache(str_replace(WWW_ROOT, '', $path) . $filename . '.js', $script, '+999 days', 'public') |
|
212 | + $path = WWW_ROOT.Configure::read('App.jsBaseUrl'); |
|
213 | + if (file_exists($path.$filename.'.js') |
|
214 | + || cache(str_replace(WWW_ROOT, '', $path).$filename.'.js', $script, '+999 days', 'public') |
|
215 | 215 | ) { |
216 | 216 | return $this->Html->script($filename); |
217 | 217 | } |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | * @return void |
265 | 265 | */ |
266 | 266 | protected function _createVars() { |
267 | - if (!empty($this->_jsVars)) { |
|
268 | - $setVar = (strpos($this->setVariable, '.')) ? $this->setVariable : 'window.' . $this->setVariable; |
|
269 | - $this->buffer($setVar . ' = ' . $this->object($this->_jsVars) . ';', true); |
|
267 | + if ( ! empty($this->_jsVars)) { |
|
268 | + $setVar = (strpos($this->setVariable, '.')) ? $this->setVariable : 'window.'.$this->setVariable; |
|
269 | + $this->buffer($setVar.' = '.$this->object($this->_jsVars).';', true); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::link |
291 | 291 | */ |
292 | 292 | public function link($title, $url = null, $options = array()) { |
293 | - if (!isset($options['id'])) { |
|
294 | - $options['id'] = 'link-' . intval(mt_rand()); |
|
293 | + if ( ! isset($options['id'])) { |
|
294 | + $options['id'] = 'link-'.intval(mt_rand()); |
|
295 | 295 | } |
296 | 296 | list($options, $htmlOptions) = $this->_getHtmlOptions($options); |
297 | 297 | $out = $this->Html->link($title, $url, $htmlOptions); |
298 | - $this->get('#' . $htmlOptions['id']); |
|
298 | + $this->get('#'.$htmlOptions['id']); |
|
299 | 299 | $requestString = $event = ''; |
300 | 300 | if (isset($options['confirm'])) { |
301 | 301 | $requestString = $this->confirmReturn($options['confirm']); |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | |
308 | 308 | $requestString .= $this->request($url, $options); |
309 | 309 | |
310 | - if (!empty($requestString)) { |
|
310 | + if ( ! empty($requestString)) { |
|
311 | 311 | $event = $this->event('click', $requestString, $options + array('buffer' => $buffer)); |
312 | 312 | } |
313 | - if (isset($buffer) && !$buffer) { |
|
313 | + if (isset($buffer) && ! $buffer) { |
|
314 | 314 | $opts = array('safe' => $safe); |
315 | 315 | $out .= $this->Html->scriptBlock($event, $opts); |
316 | 316 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } else { |
339 | 339 | $data = array($one => $two); |
340 | 340 | } |
341 | - if (!$data) { |
|
341 | + if ( ! $data) { |
|
342 | 342 | return false; |
343 | 343 | } |
344 | 344 | $this->_jsVars = array_merge($this->_jsVars, $data); |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#JsHelper::submit |
367 | 367 | */ |
368 | 368 | public function submit($caption = null, $options = array()) { |
369 | - if (!isset($options['id'])) { |
|
370 | - $options['id'] = 'submit-' . intval(mt_rand()); |
|
369 | + if ( ! isset($options['id'])) { |
|
370 | + $options['id'] = 'submit-'.intval(mt_rand()); |
|
371 | 371 | } |
372 | 372 | $formOptions = array('div'); |
373 | 373 | list($options, $htmlOptions) = $this->_getHtmlOptions($options, $formOptions); |
374 | 374 | $out = $this->Form->submit($caption, $htmlOptions); |
375 | 375 | |
376 | - $this->get('#' . $htmlOptions['id']); |
|
376 | + $this->get('#'.$htmlOptions['id']); |
|
377 | 377 | |
378 | 378 | $options['data'] = $this->serializeForm(array('isForm' => false, 'inline' => true)); |
379 | 379 | $requestString = $url = ''; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $url = $options['url']; |
386 | 386 | unset($options['url']); |
387 | 387 | } |
388 | - if (!isset($options['method'])) { |
|
388 | + if ( ! isset($options['method'])) { |
|
389 | 389 | $options['method'] = 'post'; |
390 | 390 | } |
391 | 391 | $options['dataExpression'] = true; |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | unset($options['buffer'], $options['safe']); |
396 | 396 | |
397 | 397 | $requestString .= $this->request($url, $options); |
398 | - if (!empty($requestString)) { |
|
398 | + if ( ! empty($requestString)) { |
|
399 | 399 | $event = $this->event('click', $requestString, $options + array('buffer' => $buffer)); |
400 | 400 | } |
401 | - if (isset($buffer) && !$buffer) { |
|
401 | + if (isset($buffer) && ! $buffer) { |
|
402 | 402 | $opts = array('safe' => $safe); |
403 | 403 | $out .= $this->Html->scriptBlock($event, $opts); |
404 | 404 | } |
@@ -83,7 +83,7 @@ |
||
83 | 83 | * Magic isset check for deprecated attributes. |
84 | 84 | * |
85 | 85 | * @param string $name Name of the attribute to check. |
86 | - * @return boolean |
|
86 | + * @return boolean|null |
|
87 | 87 | */ |
88 | 88 | public function __isset($name) { |
89 | 89 | if (isset($this->{$name})) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $settings = Hash::merge(array('engine' => 'CakeTime'), $settings); |
55 | 55 | parent::__construct($View, $settings); |
56 | 56 | list($plugin, $engineClass) = pluginSplit($settings['engine'], true); |
57 | - App::uses($engineClass, $plugin . 'Utility'); |
|
57 | + App::uses($engineClass, $plugin.'Utility'); |
|
58 | 58 | if (class_exists($engineClass)) { |
59 | 59 | $this->_engine = new $engineClass($settings); |
60 | 60 | } else { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | public function timeAgoInWords($dateTime, $options = array()) { |
401 | 401 | $element = null; |
402 | 402 | |
403 | - if (!empty($options['element'])) { |
|
403 | + if ( ! empty($options['element'])) { |
|
404 | 404 | $element = array( |
405 | 405 | 'tag' => 'span', |
406 | 406 | 'class' => 'time-ago-in-words', |
@@ -185,10 +185,6 @@ |
||
185 | 185 | * Defaults to false. |
186 | 186 | * |
187 | 187 | * |
188 | - * @param string $callback|CakeEvent Method to fire on all the objects. Its assumed all the objects implement |
|
189 | - * the method you are calling. If an instance of CakeEvent is provided, then then Event name will parsed to |
|
190 | - * get the callback name. This is done by getting the last word after any dot in the event name |
|
191 | - * (eg. `Model.afterSave` event will trigger the `afterSave` callback) |
|
192 | 188 | * @param array $params Array of parameters for the triggered callback. |
193 | 189 | * @param array $options Array of options. |
194 | 190 | * @return mixed Either the last result or all results if collectReturn is on. |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | $this->load($helper); |
64 | 64 | } catch (MissingHelperException $exception) { |
65 | 65 | if ($this->_View->plugin) { |
66 | - $this->load($this->_View->plugin . '.' . $helper); |
|
66 | + $this->load($this->_View->plugin.'.'.$helper); |
|
67 | 67 | return true; |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - if (!empty($exception)) { |
|
71 | + if ( ! empty($exception)) { |
|
72 | 72 | throw $exception; |
73 | 73 | } |
74 | 74 | |
@@ -118,16 +118,16 @@ discard block |
||
118 | 118 | $helper = $settings['className']; |
119 | 119 | } |
120 | 120 | list($plugin, $name) = pluginSplit($helper, true); |
121 | - if (!isset($alias)) { |
|
121 | + if ( ! isset($alias)) { |
|
122 | 122 | $alias = $name; |
123 | 123 | } |
124 | 124 | |
125 | 125 | if (isset($this->_loaded[$alias])) { |
126 | 126 | return $this->_loaded[$alias]; |
127 | 127 | } |
128 | - $helperClass = $name . 'Helper'; |
|
129 | - App::uses($helperClass, $plugin . 'View/Helper'); |
|
130 | - if (!class_exists($helperClass)) { |
|
128 | + $helperClass = $name.'Helper'; |
|
129 | + App::uses($helperClass, $plugin.'View/Helper'); |
|
130 | + if ( ! class_exists($helperClass)) { |
|
131 | 131 | throw new MissingHelperException(array( |
132 | 132 | 'class' => $helperClass, |
133 | 133 | 'plugin' => substr($plugin, 0, -1) |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * |
498 | 498 | * @param string $content Content to render in a view, wrapped by the surrounding layout. |
499 | 499 | * @param string $layout Layout name |
500 | - * @return mixed Rendered output, or false on error |
|
500 | + * @return string Rendered output, or false on error |
|
501 | 501 | * @throws CakeException if there is an error in the view. |
502 | 502 | */ |
503 | 503 | public function renderLayout($content, $layout = null) { |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | * block will create the block. |
635 | 635 | * |
636 | 636 | * @param string $name Name of the block |
637 | - * @param mixed $value The content for the block. |
|
637 | + * @param string $value The content for the block. |
|
638 | 638 | * @return void |
639 | 639 | * @see ViewBlock::concat() |
640 | 640 | */ |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * @param string|array $one A string or an array of data. |
783 | 783 | * @param string|array $two Value in case $one is a string (which then works as the key). |
784 | 784 | * Unused if $one is an associative array, otherwise serves as the values to $one's keys. |
785 | - * @return void |
|
785 | + * @return false|null |
|
786 | 786 | */ |
787 | 787 | public function set($one, $two = null) { |
788 | 788 | $data = null; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | /** |
923 | 923 | * Sandbox method to evaluate a template / view script in. |
924 | 924 | * |
925 | - * @param string $viewFn Filename of the view |
|
925 | + * @param string $viewFile Filename of the view |
|
926 | 926 | * @param array $dataForView Data to include in rendered view. |
927 | 927 | * If empty the current View::$viewVars will be used. |
928 | 928 | * @return string Rendered output |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | /** |
1066 | 1066 | * Get the extensions that view files can use. |
1067 | 1067 | * |
1068 | - * @return array Array of extensions view files use. |
|
1068 | + * @return string[] Array of extensions view files use. |
|
1069 | 1069 | */ |
1070 | 1070 | protected function _getExtensions() { |
1071 | 1071 | $exts = array($this->ext); |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | * Finds an element filename, returns false on failure. |
1080 | 1080 | * |
1081 | 1081 | * @param string $name The name of the element to find. |
1082 | - * @return mixed Either a string to the element filename or false when one can't be found. |
|
1082 | + * @return string|false Either a string to the element filename or false when one can't be found. |
|
1083 | 1083 | */ |
1084 | 1084 | protected function _getElementFileName($name) { |
1085 | 1085 | list($plugin, $name) = $this->pluginSplit($name); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | } |
333 | 333 | $this->_eventManager = $controller->getEventManager(); |
334 | 334 | } |
335 | - if (empty($this->request) && !($this->request = Router::getRequest(true))) { |
|
335 | + if (empty($this->request) && ! ($this->request = Router::getRequest(true))) { |
|
336 | 336 | $this->request = new CakeRequest(null, false); |
337 | 337 | $this->request->base = ''; |
338 | 338 | $this->request->here = $this->request->webroot = '/'; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | if (empty($this->_eventManager)) { |
360 | 360 | $this->_eventManager = new CakeEventManager(); |
361 | 361 | } |
362 | - if (!$this->_eventManagerConfigured) { |
|
362 | + if ( ! $this->_eventManagerConfigured) { |
|
363 | 363 | $this->_eventManager->attach($this->Helpers); |
364 | 364 | $this->_eventManagerConfigured = true; |
365 | 365 | } |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | $file = $plugin = null; |
394 | 394 | |
395 | 395 | if (isset($options['plugin'])) { |
396 | - $name = Inflector::camelize($options['plugin']) . '.' . $name; |
|
396 | + $name = Inflector::camelize($options['plugin']).'.'.$name; |
|
397 | 397 | } |
398 | 398 | |
399 | - if (!isset($options['callbacks'])) { |
|
399 | + if ( ! isset($options['callbacks'])) { |
|
400 | 400 | $options['callbacks'] = false; |
401 | 401 | } |
402 | 402 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if (empty($options['ignoreMissing'])) { |
416 | 416 | list ($plugin, $name) = pluginSplit($name, true); |
417 | 417 | $name = str_replace('/', DS, $name); |
418 | - $file = $plugin . 'Elements' . DS . $name . $this->ext; |
|
418 | + $file = $plugin.'Elements'.DS.$name.$this->ext; |
|
419 | 419 | trigger_error(__d('cake_dev', 'Element Not Found: %s', $file), E_USER_NOTICE); |
420 | 420 | } |
421 | 421 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return boolean Success |
430 | 430 | */ |
431 | 431 | public function elementExists($name) { |
432 | - return (bool)$this->_getElementFilename($name); |
|
432 | + return (bool) $this->_getElementFilename($name); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
@@ -514,14 +514,14 @@ discard block |
||
514 | 514 | $this->getEventManager()->dispatch(new CakeEvent('View.beforeLayout', $this, array($layoutFileName))); |
515 | 515 | |
516 | 516 | $scripts = implode("\n\t", $this->_scripts); |
517 | - $scripts .= $this->Blocks->get('meta') . $this->Blocks->get('css') . $this->Blocks->get('script'); |
|
517 | + $scripts .= $this->Blocks->get('meta').$this->Blocks->get('css').$this->Blocks->get('script'); |
|
518 | 518 | |
519 | 519 | $this->viewVars = array_merge($this->viewVars, array( |
520 | 520 | 'content_for_layout' => $content, |
521 | 521 | 'scripts_for_layout' => $scripts, |
522 | 522 | )); |
523 | 523 | |
524 | - if (!isset($this->viewVars['title_for_layout'])) { |
|
524 | + if ( ! isset($this->viewVars['title_for_layout'])) { |
|
525 | 525 | $this->viewVars['title_for_layout'] = Inflector::humanize($this->viewPath); |
526 | 526 | } |
527 | 527 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | $type = $response->mapType($response->type()); |
549 | 549 | if (Configure::read('debug') > 0 && $type === 'html') { |
550 | - echo "<!-- Cached Render Time: " . round(microtime(true) - $timeStart, 4) . "s -->"; |
|
550 | + echo "<!-- Cached Render Time: ".round(microtime(true) - $timeStart, 4)."s -->"; |
|
551 | 551 | } |
552 | 552 | $out = ob_get_clean(); |
553 | 553 | |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * @return mixed The content of the named var if its set, otherwise null. |
592 | 592 | */ |
593 | 593 | public function get($var) { |
594 | - if (!isset($this->viewVars[$var])) { |
|
594 | + if ( ! isset($this->viewVars[$var])) { |
|
595 | 595 | return null; |
596 | 596 | } |
597 | 597 | return $this->viewVars[$var]; |
@@ -707,14 +707,14 @@ discard block |
||
707 | 707 | switch ($this->_currentType) { |
708 | 708 | case self::TYPE_ELEMENT: |
709 | 709 | $parent = $this->_getElementFileName($name); |
710 | - if (!$parent) { |
|
710 | + if ( ! $parent) { |
|
711 | 711 | list($plugin, $name) = $this->pluginSplit($name); |
712 | 712 | $paths = $this->_paths($plugin); |
713 | - $defaultPath = $paths[0] . 'Elements' . DS; |
|
713 | + $defaultPath = $paths[0].'Elements'.DS; |
|
714 | 714 | throw new LogicException(__d( |
715 | 715 | 'cake_dev', |
716 | 716 | 'You cannot extend an element which does not exist (%s).', |
717 | - $defaultPath . $name . $this->ext |
|
717 | + $defaultPath.$name.$this->ext |
|
718 | 718 | )); |
719 | 719 | } |
720 | 720 | break; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | */ |
749 | 749 | public function addScript($name, $content = null) { |
750 | 750 | if (empty($content)) { |
751 | - if (!in_array($name, array_values($this->_scripts))) { |
|
751 | + if ( ! in_array($name, array_values($this->_scripts))) { |
|
752 | 752 | $this->_scripts[] = $name; |
753 | 753 | } |
754 | 754 | } else { |
@@ -766,9 +766,9 @@ discard block |
||
766 | 766 | public function uuid($object, $url) { |
767 | 767 | $c = 1; |
768 | 768 | $url = Router::url($url); |
769 | - $hash = $object . substr(md5($object . $url), 0, 10); |
|
769 | + $hash = $object.substr(md5($object.$url), 0, 10); |
|
770 | 770 | while (in_array($hash, $this->uuids)) { |
771 | - $hash = $object . substr(md5($object . $url . $c), 0, 10); |
|
771 | + $hash = $object.substr(md5($object.$url.$c), 0, 10); |
|
772 | 772 | $c++; |
773 | 773 | } |
774 | 774 | $this->uuids[] = $hash; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | } else { |
796 | 796 | $data = array($one => $two); |
797 | 797 | } |
798 | - if (!$data) { |
|
798 | + if ( ! $data) { |
|
799 | 799 | return false; |
800 | 800 | } |
801 | 801 | $this->viewVars = $data + $this->viewVars; |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | $subDir = null; |
964 | 964 | |
965 | 965 | if ($this->subDir !== null) { |
966 | - $subDir = $this->subDir . DS; |
|
966 | + $subDir = $this->subDir.DS; |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | if ($name === null) { |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | list($plugin, $name) = $this->pluginSplit($name); |
974 | 974 | |
975 | 975 | if (strpos($name, DS) === false && $name[0] !== '.') { |
976 | - $name = $this->viewPath . DS . $subDir . Inflector::underscore($name); |
|
976 | + $name = $this->viewPath.DS.$subDir.Inflector::underscore($name); |
|
977 | 977 | } elseif (strpos($name, DS) !== false) { |
978 | 978 | if ($name[0] === DS || $name[1] === ':') { |
979 | 979 | if (is_file($name)) { |
@@ -982,16 +982,16 @@ discard block |
||
982 | 982 | $name = trim($name, DS); |
983 | 983 | } elseif ($name[0] === '.') { |
984 | 984 | $name = substr($name, 3); |
985 | - } elseif (!$plugin || $this->viewPath !== $this->name) { |
|
986 | - $name = $this->viewPath . DS . $subDir . $name; |
|
985 | + } elseif ( ! $plugin || $this->viewPath !== $this->name) { |
|
986 | + $name = $this->viewPath.DS.$subDir.$name; |
|
987 | 987 | } |
988 | 988 | } |
989 | 989 | $paths = $this->_paths($plugin); |
990 | 990 | $exts = $this->_getExtensions(); |
991 | 991 | foreach ($exts as $ext) { |
992 | 992 | foreach ($paths as $path) { |
993 | - if (file_exists($path . $name . $ext)) { |
|
994 | - return $path . $name . $ext; |
|
993 | + if (file_exists($path.$name.$ext)) { |
|
994 | + return $path.$name.$ext; |
|
995 | 995 | } |
996 | 996 | } |
997 | 997 | } |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | } |
1009 | - throw new MissingViewException(array('file' => $defaultPath . $name . $this->ext)); |
|
1009 | + throw new MissingViewException(array('file' => $defaultPath.$name.$this->ext)); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | /** |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | $name = $second; |
1026 | 1026 | $plugin = $first; |
1027 | 1027 | } |
1028 | - if (isset($this->plugin) && !$plugin && $fallback) { |
|
1028 | + if (isset($this->plugin) && ! $plugin && $fallback) { |
|
1029 | 1029 | $plugin = $this->plugin; |
1030 | 1030 | } |
1031 | 1031 | return array($plugin, $name); |
@@ -1045,21 +1045,21 @@ discard block |
||
1045 | 1045 | $subDir = null; |
1046 | 1046 | |
1047 | 1047 | if ($this->layoutPath !== null) { |
1048 | - $subDir = $this->layoutPath . DS; |
|
1048 | + $subDir = $this->layoutPath.DS; |
|
1049 | 1049 | } |
1050 | 1050 | list($plugin, $name) = $this->pluginSplit($name); |
1051 | 1051 | $paths = $this->_paths($plugin); |
1052 | - $file = 'Layouts' . DS . $subDir . $name; |
|
1052 | + $file = 'Layouts'.DS.$subDir.$name; |
|
1053 | 1053 | |
1054 | 1054 | $exts = $this->_getExtensions(); |
1055 | 1055 | foreach ($exts as $ext) { |
1056 | 1056 | foreach ($paths as $path) { |
1057 | - if (file_exists($path . $file . $ext)) { |
|
1058 | - return $path . $file . $ext; |
|
1057 | + if (file_exists($path.$file.$ext)) { |
|
1058 | + return $path.$file.$ext; |
|
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | } |
1062 | - throw new MissingLayoutException(array('file' => $paths[0] . $file . $this->ext)); |
|
1062 | + throw new MissingLayoutException(array('file' => $paths[0].$file.$this->ext)); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | /** |
@@ -1088,8 +1088,8 @@ discard block |
||
1088 | 1088 | $exts = $this->_getExtensions(); |
1089 | 1089 | foreach ($exts as $ext) { |
1090 | 1090 | foreach ($paths as $path) { |
1091 | - if (file_exists($path . 'Elements' . DS . $name . $ext)) { |
|
1092 | - return $path . 'Elements' . DS . $name . $ext; |
|
1091 | + if (file_exists($path.'Elements'.DS.$name.$ext)) { |
|
1092 | + return $path.'Elements'.DS.$name.$ext; |
|
1093 | 1093 | } |
1094 | 1094 | } |
1095 | 1095 | } |
@@ -1104,33 +1104,33 @@ discard block |
||
1104 | 1104 | * @return array paths |
1105 | 1105 | */ |
1106 | 1106 | protected function _paths($plugin = null, $cached = true) { |
1107 | - if ($plugin === null && $cached === true && !empty($this->_paths)) { |
|
1107 | + if ($plugin === null && $cached === true && ! empty($this->_paths)) { |
|
1108 | 1108 | return $this->_paths; |
1109 | 1109 | } |
1110 | 1110 | $paths = array(); |
1111 | 1111 | $viewPaths = App::path('View'); |
1112 | 1112 | $corePaths = array_merge(App::core('View'), App::core('Console/Templates/skel/View')); |
1113 | 1113 | |
1114 | - if (!empty($plugin)) { |
|
1114 | + if ( ! empty($plugin)) { |
|
1115 | 1115 | $count = count($viewPaths); |
1116 | 1116 | for ($i = 0; $i < $count; $i++) { |
1117 | - if (!in_array($viewPaths[$i], $corePaths)) { |
|
1118 | - $paths[] = $viewPaths[$i] . 'Plugin' . DS . $plugin . DS; |
|
1117 | + if ( ! in_array($viewPaths[$i], $corePaths)) { |
|
1118 | + $paths[] = $viewPaths[$i].'Plugin'.DS.$plugin.DS; |
|
1119 | 1119 | } |
1120 | 1120 | } |
1121 | 1121 | $paths = array_merge($paths, App::path('View', $plugin)); |
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | $paths = array_unique(array_merge($paths, $viewPaths)); |
1125 | - if (!empty($this->theme)) { |
|
1125 | + if ( ! empty($this->theme)) { |
|
1126 | 1126 | $theme = Inflector::camelize($this->theme); |
1127 | 1127 | $themePaths = array(); |
1128 | 1128 | foreach ($paths as $path) { |
1129 | - if (strpos($path, DS . 'Plugin' . DS) === false) { |
|
1129 | + if (strpos($path, DS.'Plugin'.DS) === false) { |
|
1130 | 1130 | if ($plugin) { |
1131 | - $themePaths[] = $path . 'Themed' . DS . $theme . DS . 'Plugin' . DS . $plugin . DS; |
|
1131 | + $themePaths[] = $path.'Themed'.DS.$theme.DS.'Plugin'.DS.$plugin.DS; |
|
1132 | 1132 | } |
1133 | - $themePaths[] = $path . 'Themed' . DS . $theme . DS; |
|
1133 | + $themePaths[] = $path.'Themed'.DS.$theme.DS; |
|
1134 | 1134 | } |
1135 | 1135 | } |
1136 | 1136 | $paths = array_merge($themePaths, $paths); |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | ); |
1171 | 1171 | $this->elementCacheSettings = array_merge($defaults, $options['cache']); |
1172 | 1172 | } |
1173 | - $this->elementCacheSettings['key'] = 'element_' . $this->elementCacheSettings['key']; |
|
1173 | + $this->elementCacheSettings['key'] = 'element_'.$this->elementCacheSettings['key']; |
|
1174 | 1174 | return Cache::read($this->elementCacheSettings['key'], $this->elementCacheSettings['config']); |
1175 | 1175 | } |
1176 | 1176 |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param ComponentCollection $collection |
128 | 128 | * @param array $settings |
129 | - * @return \ToolbarComponent |
|
129 | + * @return boolean |
|
130 | 130 | */ |
131 | 131 | public function __construct(ComponentCollection $collection, $settings = array()) { |
132 | 132 | $settings = array_merge((array)Configure::read('DebugKit'), $settings); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * If automatically disabled, tell component collection about the state. |
229 | 229 | * |
230 | 230 | * @param Controller $controller |
231 | - * @return boolean |
|
231 | + * @return boolean|null |
|
232 | 232 | */ |
233 | 233 | public function initialize(Controller $controller) { |
234 | 234 | if (!$this->enabled) { |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * Component Startup |
270 | 270 | * |
271 | 271 | * @param Controller $controller |
272 | - * @return boolean |
|
272 | + * @return boolean|null |
|
273 | 273 | */ |
274 | 274 | public function startup(Controller $controller) { |
275 | 275 | $panels = array_keys($this->panels); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Save the current state of the toolbar varibles to the cache file. |
459 | 459 | * |
460 | - * @param \Controller|object $controller Controller instance |
|
460 | + * @param Controller $controller Controller instance |
|
461 | 461 | * @param array $vars Vars to save. |
462 | 462 | * @return void |
463 | 463 | */ |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DebugKit DebugToolbar Component |
|
4 | - * |
|
5 | - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
6 | - * |
|
7 | - * Licensed under The MIT License |
|
8 | - * Redistributions of files must retain the above copyright notice. |
|
9 | - * |
|
10 | - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
11 | - * @link http://cakephp.org CakePHP(tm) Project |
|
12 | - * @since DebugKit 0.1 |
|
13 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
14 | - */ |
|
3 | + * DebugKit DebugToolbar Component |
|
4 | + * |
|
5 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
6 | + * |
|
7 | + * Licensed under The MIT License |
|
8 | + * Redistributions of files must retain the above copyright notice. |
|
9 | + * |
|
10 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
|
11 | + * @link http://cakephp.org CakePHP(tm) Project |
|
12 | + * @since DebugKit 0.1 |
|
13 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
14 | + */ |
|
15 | 15 | |
16 | 16 | App::uses('CakeLog', 'Log'); |
17 | 17 | App::uses('CakeLogInterface', 'Log'); |
@@ -386,9 +386,9 @@ discard block |
||
386 | 386 | return; |
387 | 387 | } |
388 | 388 | $cache = array( |
389 | - 'duration' => $this->cacheDuration, |
|
390 | - 'engine' => 'File', |
|
391 | - 'path' => CACHE |
|
389 | + 'duration' => $this->cacheDuration, |
|
390 | + 'engine' => 'File', |
|
391 | + 'path' => CACHE |
|
392 | 392 | ); |
393 | 393 | if (isset($this->settings['cache'])) { |
394 | 394 | $cache = array_merge($cache, $this->settings['cache']); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return \ToolbarComponent |
130 | 130 | */ |
131 | 131 | public function __construct(ComponentCollection $collection, $settings = array()) { |
132 | - $settings = array_merge((array)Configure::read('DebugKit'), $settings); |
|
132 | + $settings = array_merge((array) Configure::read('DebugKit'), $settings); |
|
133 | 133 | $panels = $this->_defaultPanels; |
134 | 134 | if (isset($settings['panels'])) { |
135 | 135 | $panels = $this->_makePanelList($settings['panels']); |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | } |
138 | 138 | $this->controller = $collection->getController(); |
139 | 139 | |
140 | - parent::__construct($collection, array_merge($this->settings, (array)$settings)); |
|
140 | + parent::__construct($collection, array_merge($this->settings, (array) $settings)); |
|
141 | 141 | |
142 | 142 | if ( |
143 | - !Configure::read('debug') && |
|
143 | + ! Configure::read('debug') && |
|
144 | 144 | empty($this->settings['forceEnable']) |
145 | 145 | ) { |
146 | 146 | $this->enabled = false; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | if ( |
150 | 150 | $this->settings['autoRun'] === false && |
151 | - !isset($this->controller->request->query['debug']) |
|
151 | + ! isset($this->controller->request->query['debug']) |
|
152 | 152 | ) { |
153 | 153 | $this->enabled = false; |
154 | 154 | return false; |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | * @return array |
177 | 177 | */ |
178 | 178 | public function implementedEvents() { |
179 | - $before = function ($name) { |
|
180 | - return function () use ($name) { |
|
179 | + $before = function($name) { |
|
180 | + return function() use ($name) { |
|
181 | 181 | DebugTimer::start($name, $name); |
182 | 182 | }; |
183 | 183 | }; |
184 | - $after = function ($name) { |
|
185 | - return function () use ($name) { |
|
184 | + $after = function($name) { |
|
185 | + return function() use ($name) { |
|
186 | 186 | DebugTimer::stop($name); |
187 | 187 | }; |
188 | 188 | }; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @return boolean |
232 | 232 | */ |
233 | 233 | public function initialize(Controller $controller) { |
234 | - if (!$this->enabled) { |
|
234 | + if ( ! $this->enabled) { |
|
235 | 235 | $this->_Collection->disable('Toolbar'); |
236 | 236 | } |
237 | 237 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | // Compatibility for when panels were not |
257 | 257 | // required to have a plugin prefix. |
258 | - $alternate = 'DebugKit.' . ucfirst($key); |
|
258 | + $alternate = 'DebugKit.'.ucfirst($key); |
|
259 | 259 | $index = array_search($alternate, $panels); |
260 | 260 | if ($index !== false) { |
261 | 261 | unset($panels[$index]); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @return void |
296 | 296 | */ |
297 | 297 | public function beforeRedirect(Controller $controller, $url, $status = null, $exit = true) { |
298 | - if (!class_exists('DebugTimer')) { |
|
298 | + if ( ! class_exists('DebugTimer')) { |
|
299 | 299 | return null; |
300 | 300 | } |
301 | 301 | DebugTimer::stop('controllerAction'); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @return void |
318 | 318 | */ |
319 | 319 | public function beforeRender(Controller $controller) { |
320 | - if (!class_exists('DebugTimer')) { |
|
320 | + if ( ! class_exists('DebugTimer')) { |
|
321 | 321 | return null; |
322 | 322 | } |
323 | 323 | DebugTimer::stop('controllerAction'); |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | )); |
341 | 341 | |
342 | 342 | $isHtml = ( |
343 | - !isset($controller->request->params['ext']) || |
|
343 | + ! isset($controller->request->params['ext']) || |
|
344 | 344 | $controller->request->params['ext'] === 'html' |
345 | 345 | ); |
346 | 346 | |
347 | - if (!$controller->request->is('ajax') && $isHtml) { |
|
347 | + if ( ! $controller->request->is('ajax') && $isHtml) { |
|
348 | 348 | $format = 'Html'; |
349 | 349 | } else { |
350 | 350 | $format = 'FirePhp'; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $panel = $this->panels[$panelName]; |
411 | 411 | $panelName = Inflector::underscore($panelName); |
412 | 412 | $vars[$panelName]['content'] = $panel->beforeRender($controller); |
413 | - $elementName = Inflector::underscore($panelName) . '_panel'; |
|
413 | + $elementName = Inflector::underscore($panelName).'_panel'; |
|
414 | 414 | if (isset($panel->elementName)) { |
415 | 415 | $elementName = $panel->elementName; |
416 | 416 | } |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | $vars[$panelName]['title'] = $panel->title; |
420 | 420 | $vars[$panelName]['disableTimer'] = true; |
421 | 421 | |
422 | - if (!empty($panel->javascript)) { |
|
423 | - $vars['javascript'] = array_merge($vars['javascript'], (array)$panel->javascript); |
|
422 | + if ( ! empty($panel->javascript)) { |
|
423 | + $vars['javascript'] = array_merge($vars['javascript'], (array) $panel->javascript); |
|
424 | 424 | } |
425 | - if (!empty($panel->css)) { |
|
426 | - $vars['css'] = array_merge($vars['css'], (array)$panel->css); |
|
425 | + if ( ! empty($panel->css)) { |
|
426 | + $vars['css'] = array_merge($vars['css'], (array) $panel->css); |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | return $vars; |
@@ -438,11 +438,11 @@ discard block |
||
438 | 438 | */ |
439 | 439 | protected function _loadPanels($panels, $settings) { |
440 | 440 | foreach ($panels as $panel) { |
441 | - $className = ucfirst($panel) . 'Panel'; |
|
441 | + $className = ucfirst($panel).'Panel'; |
|
442 | 442 | list($plugin, $className) = pluginSplit($className, true); |
443 | 443 | |
444 | - App::uses($className, $plugin . 'Panel'); |
|
445 | - if (!class_exists($className)) { |
|
444 | + App::uses($className, $plugin.'Panel'); |
|
445 | + if ( ! class_exists($className)) { |
|
446 | 446 | trigger_error(__d('debug_kit', 'Could not load DebugToolbar panel %s', $panel), E_USER_WARNING); |
447 | 447 | continue; |
448 | 448 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | protected function _saveState(Controller $controller, $vars) { |
465 | 465 | $config = Cache::config('debug_kit'); |
466 | - if (empty($config) || !isset($this->panels['history'])) { |
|
466 | + if (empty($config) || ! isset($this->panels['history'])) { |
|
467 | 467 | return; |
468 | 468 | } |
469 | 469 | $history = Cache::read($this->cacheKey, 'debug_kit'); |
@@ -476,13 +476,13 @@ discard block |
||
476 | 476 | |
477 | 477 | if (isset($vars['variables']['content'])) { |
478 | 478 | // Remove unserializable native objects. |
479 | - array_walk_recursive($vars['variables']['content'], function (&$item) { |
|
479 | + array_walk_recursive($vars['variables']['content'], function(&$item) { |
|
480 | 480 | if ( |
481 | 481 | $item instanceof Closure || |
482 | 482 | $item instanceof PDO || |
483 | 483 | $item instanceof SimpleXmlElement |
484 | 484 | ) { |
485 | - $item = 'Unserializable object - ' . get_class($item); |
|
485 | + $item = 'Unserializable object - '.get_class($item); |
|
486 | 486 | } elseif ($item instanceof Exception) { |
487 | 487 | $item = sprintf( |
488 | 488 | 'Unserializable object - %s. Error: %s in %s, line %s', |
@@ -528,7 +528,7 @@ |
||
528 | 528 | /** |
529 | 529 | * Send Headers - write headers. |
530 | 530 | * |
531 | - * @param $name |
|
531 | + * @param string $name |
|
532 | 532 | * @param $value |
533 | 533 | * @return void |
534 | 534 | */ |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | App::uses('Debugger', 'Utility'); |
16 | 16 | |
17 | -if (!function_exists('firecake')) { |
|
17 | +if ( ! function_exists('firecake')) { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Procedural version of FireCake::log() |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public static function getInstance($class = null) { |
122 | 122 | static $instance = array(); |
123 | - if (!empty($class)) { |
|
124 | - if (!$instance || strtolower($class) !== strtolower(get_class($instance[0]))) { |
|
123 | + if ( ! empty($class)) { |
|
124 | + if ( ! $instance || strtolower($class) !== strtolower(get_class($instance[0]))) { |
|
125 | 125 | $instance[0] = new $class(); |
126 | 126 | $instance[0]->setOptions(); |
127 | 127 | } |
128 | 128 | } |
129 | - if (!isset($instance[0]) || !$instance[0]) { |
|
129 | + if ( ! isset($instance[0]) || ! $instance[0]) { |
|
130 | 130 | $instance[0] = new FireCake(); |
131 | 131 | $instance[0]->setOptions(); |
132 | 132 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | trigger_error(__d('debug_kit', 'Headers already sent in %s on line %s. Cannot send log data to FirePHP.', $filename, $linenum), E_USER_WARNING); |
311 | 311 | return false; |
312 | 312 | } |
313 | - if (!$_this->_enabled || !$_this->detectClientExtension()) { |
|
313 | + if ( ! $_this->_enabled || ! $_this->detectClientExtension()) { |
|
314 | 314 | return false; |
315 | 315 | } |
316 | 316 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $skipFinalObjectEncode = false; |
342 | 342 | if ($type == $_this->_levels['trace']) { |
343 | 343 | $trace = debug_backtrace(); |
344 | - if (!$trace) { |
|
344 | + if ( ! $trace) { |
|
345 | 345 | return false; |
346 | 346 | } |
347 | 347 | $message = FireCake::_parseTrace($trace, $args[0]); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | } |
350 | 350 | |
351 | 351 | if ($_this->options['includeLineNumbers']) { |
352 | - if (!isset($meta['file']) || !isset($meta['line'])) { |
|
352 | + if ( ! isset($meta['file']) || ! isset($meta['line'])) { |
|
353 | 353 | $trace = debug_backtrace(); |
354 | 354 | for ($i = 0, $len = count($trace); $i < $len; $i++) { |
355 | 355 | $keySet = (isset($trace[$i]['class']) && isset($trace[$i]['function'])); |
@@ -375,19 +375,19 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | $_this->_sendHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); |
378 | - $_this->_sendHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/' . $_this->_version); |
|
378 | + $_this->_sendHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.$_this->_version); |
|
379 | 379 | if ($type == $_this->_levels['groupStart']) { |
380 | 380 | $meta['Collapsed'] = 'true'; |
381 | 381 | } |
382 | 382 | if ($type == $_this->_levels['dump']) { |
383 | 383 | $dump = FireCake::jsonEncode($message); |
384 | - $msg = '{"' . $label . '":' . $dump . '}'; |
|
384 | + $msg = '{"'.$label.'":'.$dump.'}'; |
|
385 | 385 | } else { |
386 | 386 | $meta['Type'] = $type; |
387 | 387 | if ($label !== null) { |
388 | 388 | $meta['Label'] = $label; |
389 | 389 | } |
390 | - $msg = '[' . $_this->jsonEncode($meta) . ',' . $_this->jsonEncode($message, $skipFinalObjectEncode) . ']'; |
|
390 | + $msg = '['.$_this->jsonEncode($meta).','.$_this->jsonEncode($message, $skipFinalObjectEncode).']'; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | $lines = explode("\n", chunk_split($msg, 5000, "\n")); |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | if (empty($line)) { |
397 | 397 | continue; |
398 | 398 | } |
399 | - $header = 'X-Wf-1-' . $structureIndex . '-1-' . $_this->_messageIndex; |
|
399 | + $header = 'X-Wf-1-'.$structureIndex.'-1-'.$_this->_messageIndex; |
|
400 | 400 | if (count($lines) > 2) { |
401 | 401 | $first = ($i == 0) ? strlen($msg) : ''; |
402 | 402 | $end = ($i < count($lines) - 2) ? '\\' : ''; |
403 | - $message = $first . '|' . $line . '|' . $end; |
|
403 | + $message = $first.'|'.$line.'|'.$end; |
|
404 | 404 | $_this->_sendHeader($header, $message); |
405 | 405 | } else { |
406 | - $_this->_sendHeader($header, strlen($line) . '|' . $line . '|'); |
|
406 | + $_this->_sendHeader($header, strlen($line).'|'.$line.'|'); |
|
407 | 407 | } |
408 | 408 | $_this->_messageIndex++; |
409 | 409 | if ($_this->_messageIndex > 99999) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | for ($i = 0, $len = count($trace); $i < $len; $i++) { |
427 | 427 | $keySet = (isset($trace[$i]['class']) && isset($trace[$i]['function'])); |
428 | 428 | $selfCall = ($keySet && $trace[$i]['class'] === 'FireCake'); |
429 | - if (!$selfCall) { |
|
429 | + if ( ! $selfCall) { |
|
430 | 430 | $message = array( |
431 | 431 | 'Class' => isset($trace[$i]['class']) ? $trace[$i]['class'] : '', |
432 | 432 | 'Type' => isset($trace[$i]['type']) ? $trace[$i]['type'] : '', |
@@ -474,15 +474,15 @@ discard block |
||
474 | 474 | $_this = FireCake::getInstance(); |
475 | 475 | $return = array(); |
476 | 476 | if (is_resource($object)) { |
477 | - return '** ' . (string)$object . '**'; |
|
477 | + return '** '.(string) $object.'**'; |
|
478 | 478 | } |
479 | 479 | if (is_object($object)) { |
480 | 480 | if ($objectDepth == $_this->options['maxObjectDepth']) { |
481 | - return '** Max Object Depth (' . $_this->options['maxObjectDepth'] . ') **'; |
|
481 | + return '** Max Object Depth ('.$_this->options['maxObjectDepth'].') **'; |
|
482 | 482 | } |
483 | 483 | foreach ($_this->_encodedObjects as $encoded) { |
484 | 484 | if ($encoded === $object) { |
485 | - return '** Recursion (' . get_class($object) . ') **'; |
|
485 | + return '** Recursion ('.get_class($object).') **'; |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | $_this->_encodedObjects[] = $object; |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | } |
497 | 497 | if (is_array($object)) { |
498 | 498 | if ($arrayDepth == $_this->options['maxArrayDepth']) { |
499 | - return '** Max Array Depth (' . $_this->options['maxArrayDepth'] . ') **'; |
|
499 | + return '** Max Array Depth ('.$_this->options['maxArrayDepth'].') **'; |
|
500 | 500 | } |
501 | 501 | foreach ($object as $key => $value) { |
502 | 502 | $return[$key] = FireCake::stringEncode($value, 1, $arrayDepth + 1); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | */ |
520 | 520 | public static function jsonEncode($object, $skipEncode = false) { |
521 | 521 | $_this = FireCake::getInstance(); |
522 | - if (!$skipEncode) { |
|
522 | + if ( ! $skipEncode) { |
|
523 | 523 | $object = FireCake::stringEncode($object); |
524 | 524 | } |
525 | 525 | return json_encode($object); |
@@ -533,6 +533,6 @@ discard block |
||
533 | 533 | * @return void |
534 | 534 | */ |
535 | 535 | protected function _sendHeader($name, $value) { |
536 | - header($name . ': ' . $value); |
|
536 | + header($name.': '.$value); |
|
537 | 537 | } |
538 | 538 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * Check if a path is part of cake core |
93 | 93 | * @param string $file |
94 | - * @return boolean |
|
94 | + * @return string |
|
95 | 95 | */ |
96 | 96 | protected function _isCoreFile($file) { |
97 | 97 | return strstr($file, CAKE); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * Check if a path is from APP but not a plugin |
102 | 102 | * @param string $file |
103 | - * @return boolean |
|
103 | + * @return string |
|
104 | 104 | */ |
105 | 105 | protected function _isAppFile($file) { |
106 | 106 | return strstr($file, APP); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * - app for app files |
129 | 129 | * - core for core files |
130 | 130 | * - PluginName for the name of a plugin |
131 | - * @return boolean |
|
131 | + * @return string |
|
132 | 132 | */ |
133 | 133 | protected function _niceFileName($file, $type) { |
134 | 134 | switch ($type) { |
@@ -1,15 +1,15 @@ |
||
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 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
12 | - */ |
|
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 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | App::uses('DebugPanel', 'DebugKit.Lib'); |
15 | 15 |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return str_replace(CAKE, 'CORE/', $file); |
140 | 140 | |
141 | 141 | default: |
142 | - return str_replace($this->_pluginPaths[$type], $type . '/', $file); |
|
142 | + return str_replace($this->_pluginPaths[$type], $type.'/', $file); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | protected function _getFileType($file) { |
152 | 152 | foreach ($this->_fileTypes as $type) { |
153 | - if (stripos($file, '/' . $type . '/') !== false) { |
|
153 | + if (stripos($file, '/'.$type.'/') !== false) { |
|
154 | 154 | return $type; |
155 | 155 | } |
156 | 156 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | /** |
23 | 23 | * beforeRender callback |
24 | 24 | * |
25 | - * @param \Controller|object $controller |
|
25 | + * @param Controller $controller |
|
26 | 26 | * @return array |
27 | 27 | */ |
28 | 28 | public function beforeRender(Controller $controller) { |
@@ -1,15 +1,15 @@ |
||
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 | - * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
12 | - */ |
|
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 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|
12 | + */ |
|
13 | 13 | |
14 | 14 | App::uses('DebugPanel', 'DebugKit.Lib'); |
15 | 15 |