@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param array $settings Array of configuration settings. |
109 | 109 | */ |
110 | 110 | public function __construct(ComponentCollection $collection, $settings = array()) { |
111 | - $settings = array_merge($this->settings, (array)$settings); |
|
111 | + $settings = array_merge($this->settings, (array) $settings); |
|
112 | 112 | $this->Controller = $collection->getController(); |
113 | 113 | parent::__construct($collection, $settings); |
114 | 114 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $object = $this->_getObject($object); |
136 | 136 | |
137 | - if (!is_object($object)) { |
|
137 | + if ( ! is_object($object)) { |
|
138 | 138 | throw new MissingModelException($object); |
139 | 139 | } |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $conditions = $fields = $order = $limit = $page = $recursive = null; |
146 | 146 | |
147 | - if (!isset($options['conditions'])) { |
|
147 | + if ( ! isset($options['conditions'])) { |
|
148 | 148 | $options['conditions'] = array(); |
149 | 149 | } |
150 | 150 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | extract($options); |
159 | 159 | |
160 | - if (is_array($scope) && !empty($scope)) { |
|
160 | + if (is_array($scope) && ! empty($scope)) { |
|
161 | 161 | $conditions = array_merge($conditions, $scope); |
162 | 162 | } elseif (is_string($scope)) { |
163 | 163 | $conditions = array($conditions, $scope); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | 'conditions', 'fields', 'order', 'limit', 'page', 'recursive' |
171 | 171 | )); |
172 | 172 | |
173 | - if (!empty($extra['findType'])) { |
|
173 | + if ( ! empty($extra['findType'])) { |
|
174 | 174 | $type = $extra['findType']; |
175 | 175 | unset($extra['findType']); |
176 | 176 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | if (intval($page) < 1) { |
183 | 183 | $page = 1; |
184 | 184 | } |
185 | - $page = $options['page'] = (int)$page; |
|
185 | + $page = $options['page'] = (int) $page; |
|
186 | 186 | |
187 | 187 | if ($object->hasMethod('paginate')) { |
188 | 188 | $results = $object->paginate( |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $defaults = $this->getDefaults($object->alias); |
199 | 199 | unset($defaults[0]); |
200 | 200 | |
201 | - if (!$results) { |
|
201 | + if ( ! $results) { |
|
202 | 202 | $count = 0; |
203 | 203 | } elseif ($object->hasMethod('paginateCount')) { |
204 | 204 | $count = $object->paginateCount($conditions, $recursive, $extra); |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | 'paramType' => $options['paramType'] |
227 | 227 | ); |
228 | 228 | |
229 | - if (!isset($this->Controller->request['paging'])) { |
|
229 | + if ( ! isset($this->Controller->request['paging'])) { |
|
230 | 230 | $this->Controller->request['paging'] = array(); |
231 | 231 | } |
232 | 232 | $this->Controller->request['paging'] = array_merge( |
233 | - (array)$this->Controller->request['paging'], |
|
233 | + (array) $this->Controller->request['paging'], |
|
234 | 234 | array($object->alias => $paging) |
235 | 235 | ); |
236 | 236 | |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | if ( |
242 | - !in_array('Paginator', $this->Controller->helpers) && |
|
243 | - !array_key_exists('Paginator', $this->Controller->helpers) |
|
242 | + ! in_array('Paginator', $this->Controller->helpers) && |
|
243 | + ! array_key_exists('Paginator', $this->Controller->helpers) |
|
244 | 244 | ) { |
245 | 245 | $this->Controller->helpers[] = 'Paginator'; |
246 | 246 | } |
@@ -369,22 +369,22 @@ discard block |
||
369 | 369 | if (isset($options['direction'])) { |
370 | 370 | $direction = strtolower($options['direction']); |
371 | 371 | } |
372 | - if (!in_array($direction, array('asc', 'desc'))) { |
|
372 | + if ( ! in_array($direction, array('asc', 'desc'))) { |
|
373 | 373 | $direction = 'asc'; |
374 | 374 | } |
375 | 375 | $options['order'] = array($options['sort'] => $direction); |
376 | 376 | } |
377 | 377 | |
378 | - if (!empty($whitelist) && isset($options['order']) && is_array($options['order'])) { |
|
378 | + if ( ! empty($whitelist) && isset($options['order']) && is_array($options['order'])) { |
|
379 | 379 | $field = key($options['order']); |
380 | 380 | $inWhitelist = in_array($field, $whitelist, true); |
381 | - if (!$inWhitelist) { |
|
381 | + if ( ! $inWhitelist) { |
|
382 | 382 | $options['order'] = null; |
383 | 383 | } |
384 | 384 | return $options; |
385 | 385 | } |
386 | 386 | |
387 | - if (!empty($options['order']) && is_array($options['order'])) { |
|
387 | + if ( ! empty($options['order']) && is_array($options['order'])) { |
|
388 | 388 | $order = array(); |
389 | 389 | foreach ($options['order'] as $key => $value) { |
390 | 390 | $field = $key; |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | $correctAlias = ($object->alias === $alias); |
396 | 396 | |
397 | 397 | if ($correctAlias && $object->hasField($field)) { |
398 | - $order[$object->alias . '.' . $field] = $value; |
|
398 | + $order[$object->alias.'.'.$field] = $value; |
|
399 | 399 | } elseif ($correctAlias && $object->hasField($key, true)) { |
400 | 400 | $order[$field] = $value; |
401 | 401 | } elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field, true)) { |
402 | - $order[$alias . '.' . $field] = $value; |
|
402 | + $order[$alias.'.'.$field] = $value; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | $options['order'] = $order; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @return array An array of options for pagination |
416 | 416 | */ |
417 | 417 | public function checkLimit(array $options) { |
418 | - $options['limit'] = (int)$options['limit']; |
|
418 | + $options['limit'] = (int) $options['limit']; |
|
419 | 419 | if (empty($options['limit']) || $options['limit'] < 1) { |
420 | 420 | $options['limit'] = 1; |
421 | 421 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $this->_setExtension(); |
135 | 135 | } |
136 | 136 | $this->params = $controller->params; |
137 | - if (!empty($this->settings['viewClassMap'])) { |
|
137 | + if ( ! empty($this->settings['viewClassMap'])) { |
|
138 | 138 | $this->viewClassMap($this->settings['viewClassMap']); |
139 | 139 | } |
140 | 140 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | public function startup(Controller $controller) { |
201 | 201 | $controller->request->params['isAjax'] = $this->request->is('ajax'); |
202 | 202 | $isRecognized = ( |
203 | - !in_array($this->ext, array('html', 'htm')) && |
|
203 | + ! in_array($this->ext, array('html', 'htm')) && |
|
204 | 204 | $this->response->getMimeType($this->ext) |
205 | 205 | ); |
206 | 206 | |
207 | - if (!empty($this->ext) && $isRecognized) { |
|
207 | + if ( ! empty($this->ext) && $isRecognized) { |
|
208 | 208 | $this->renderAs($controller, $this->ext); |
209 | 209 | } elseif ($this->request->is('ajax')) { |
210 | 210 | $this->renderAs($controller, 'ajax'); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @return void |
251 | 251 | */ |
252 | 252 | public function beforeRedirect(Controller $controller, $url, $status = null, $exit = true) { |
253 | - if (!$this->request->is('ajax')) { |
|
253 | + if ( ! $this->request->is('ajax')) { |
|
254 | 254 | return; |
255 | 255 | } |
256 | 256 | if (empty($url)) { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | if (is_array($url)) { |
264 | 264 | $url = Router::url($url + array('base' => false)); |
265 | 265 | } |
266 | - if (!empty($status)) { |
|
266 | + if ( ! empty($status)) { |
|
267 | 267 | $statusCode = $this->response->httpCodes($status); |
268 | 268 | $code = key($statusCode); |
269 | 269 | $this->response->statusCode($code); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | public function accepts($type = null) { |
479 | 479 | $accepted = $this->request->accepts(); |
480 | 480 | |
481 | - if (!$type) { |
|
481 | + if ( ! $type) { |
|
482 | 482 | return $this->mapType($accepted); |
483 | 483 | } |
484 | 484 | if (is_array($type)) { |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | * in the request content type will be returned. |
506 | 506 | */ |
507 | 507 | public function requestedWith($type = null) { |
508 | - if (!$this->request->is('post') && !$this->request->is('put')) { |
|
508 | + if ( ! $this->request->is('post') && ! $this->request->is('put')) { |
|
509 | 509 | return null; |
510 | 510 | } |
511 | 511 | if (is_array($type)) { |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | if ($contentType === '') { |
522 | 522 | list($contentType) = explode(';', CakeRequest::header('CONTENT_TYPE')); |
523 | 523 | } |
524 | - if (!$type) { |
|
524 | + if ( ! $type) { |
|
525 | 525 | return $this->mapType($contentType); |
526 | 526 | } |
527 | 527 | if (is_string($type)) { |
@@ -554,17 +554,17 @@ discard block |
||
554 | 554 | } |
555 | 555 | $accepts = $this->mapType(array_shift($acceptRaw)); |
556 | 556 | |
557 | - if (!$type) { |
|
558 | - if (empty($this->ext) && !empty($accepts)) { |
|
557 | + if ( ! $type) { |
|
558 | + if (empty($this->ext) && ! empty($accepts)) { |
|
559 | 559 | return $accepts[0]; |
560 | 560 | } |
561 | 561 | return $this->ext; |
562 | 562 | } |
563 | 563 | |
564 | - $types = (array)$type; |
|
564 | + $types = (array) $type; |
|
565 | 565 | |
566 | 566 | if (count($types) === 1) { |
567 | - if (!empty($this->ext)) { |
|
567 | + if ( ! empty($this->ext)) { |
|
568 | 568 | return in_array($this->ext, $types); |
569 | 569 | } |
570 | 570 | return in_array($types[0], $accepts); |
@@ -618,18 +618,18 @@ discard block |
||
618 | 618 | } else { |
619 | 619 | $viewClass = Inflector::classify($type); |
620 | 620 | } |
621 | - $viewName = $viewClass . 'View'; |
|
622 | - if (!class_exists($viewName)) { |
|
623 | - App::uses($viewName, $pluginDot . 'View'); |
|
621 | + $viewName = $viewClass.'View'; |
|
622 | + if ( ! class_exists($viewName)) { |
|
623 | + App::uses($viewName, $pluginDot.'View'); |
|
624 | 624 | } |
625 | 625 | if (class_exists($viewName)) { |
626 | 626 | $controller->viewClass = $viewClass; |
627 | 627 | } elseif (empty($this->_renderType)) { |
628 | - $controller->viewPath .= DS . $type; |
|
628 | + $controller->viewPath .= DS.$type; |
|
629 | 629 | } else { |
630 | 630 | $controller->viewPath = preg_replace( |
631 | 631 | "/([\/\\\\]{$this->_renderType})$/", |
632 | - DS . $type, |
|
632 | + DS.$type, |
|
633 | 633 | $controller->viewPath |
634 | 634 | ); |
635 | 635 | } |
@@ -642,10 +642,10 @@ discard block |
||
642 | 642 | |
643 | 643 | $helper = ucfirst($type); |
644 | 644 | |
645 | - if (!in_array($helper, $controller->helpers) && empty($controller->helpers[$helper])) { |
|
645 | + if ( ! in_array($helper, $controller->helpers) && empty($controller->helpers[$helper])) { |
|
646 | 646 | App::uses('AppHelper', 'View/Helper'); |
647 | - App::uses($helper . 'Helper', 'View/Helper'); |
|
648 | - if (class_exists($helper . 'Helper')) { |
|
647 | + App::uses($helper.'Helper', 'View/Helper'); |
|
648 | + if (class_exists($helper.'Helper')) { |
|
649 | 649 | $controller->helpers[] = $helper; |
650 | 650 | } |
651 | 651 | } |
@@ -684,16 +684,16 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | |
687 | - if (!$type) { |
|
687 | + if ( ! $type) { |
|
688 | 688 | return false; |
689 | 689 | } |
690 | 690 | if (empty($this->request->params['requested'])) { |
691 | 691 | $this->response->type($cType); |
692 | 692 | } |
693 | - if (!empty($options['charset'])) { |
|
693 | + if ( ! empty($options['charset'])) { |
|
694 | 694 | $this->response->charset($options['charset']); |
695 | 695 | } |
696 | - if (!empty($options['attachment'])) { |
|
696 | + if ( ! empty($options['attachment'])) { |
|
697 | 697 | $this->response->download($options['attachment']); |
698 | 698 | } |
699 | 699 | return true; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | * @throws CakeException |
754 | 754 | */ |
755 | 755 | public function addInputType($type, $handler) { |
756 | - if (!is_array($handler) || !isset($handler[0]) || !is_callable($handler[0])) { |
|
756 | + if ( ! is_array($handler) || ! isset($handler[0]) || ! is_callable($handler[0])) { |
|
757 | 757 | throw new CakeException(__d('cake_dev', 'You must give a handler callback.')); |
758 | 758 | } |
759 | 759 | $this->_inputTypeMap[$type] = $handler; |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | * @return array|string Returns viewClass when only string $type is set, else array with viewClassMap |
768 | 768 | */ |
769 | 769 | public function viewClassMap($type = null, $viewClass = null) { |
770 | - if (!$viewClass && is_string($type) && isset($this->_viewClassMap[$type])) { |
|
770 | + if ( ! $viewClass && is_string($type) && isset($this->_viewClassMap[$type])) { |
|
771 | 771 | return $this->_viewClassMap[$type]; |
772 | 772 | } |
773 | 773 | if (is_string($type)) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * Modifies the $_POST and $_SERVER['REQUEST_METHOD'] to simulate a new GET request. |
245 | 245 | * |
246 | 246 | * @param Controller $controller A reference to the controller |
247 | - * @param string|array $url A string or array containing the redirect location |
|
247 | + * @param string|null $url A string or array containing the redirect location |
|
248 | 248 | * @param integer|array $status HTTP Status for redirect |
249 | 249 | * @param boolean $exit |
250 | 250 | * @return void |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * "304 Not Modified" header. |
281 | 281 | * |
282 | 282 | * @params Controller $controller |
283 | - * @return boolean false if the render process should be aborted |
|
283 | + * @return false|null false if the render process should be aborted |
|
284 | 284 | */ |
285 | 285 | public function beforeRender(Controller $controller) { |
286 | 286 | if ($this->settings['checkHttpCache'] && $this->response->checkNotModified($this->request)) { |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | * |
470 | 470 | * @param string|array $type Can be null (or no parameter), a string type name, or an |
471 | 471 | * array of types |
472 | - * @return mixed If null or no parameter is passed, returns an array of content |
|
472 | + * @return boolean If null or no parameter is passed, returns an array of content |
|
473 | 473 | * types the client accepts. If a string is passed, returns true |
474 | 474 | * if the client accepts it. If an array is passed, returns true |
475 | 475 | * if the client accepts one or more elements in the array. |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | * @param Controller $controller A reference to a controller object |
594 | 594 | * @param string $type Type of response to send (e.g: 'ajax') |
595 | 595 | * @param array $options Array of options to use |
596 | - * @return void |
|
596 | + * @return boolean|null |
|
597 | 597 | * @see RequestHandlerComponent::setContent() |
598 | 598 | * @see RequestHandlerComponent::respondAs() |
599 | 599 | */ |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | * Sets the response header based on type map index name. This wraps several methods |
656 | 656 | * available on CakeResponse. It also allows you to use Content-Type aliases. |
657 | 657 | * |
658 | - * @param string|array $type Friendly type name, i.e. 'html' or 'xml', or a full content-type, |
|
658 | + * @param string $type Friendly type name, i.e. 'html' or 'xml', or a full content-type, |
|
659 | 659 | * like 'application/x-shockwave'. |
660 | 660 | * @param array $options If $type is a friendly type name that is associated with |
661 | 661 | * more than one type of content, $index is used to select which content-type to use. |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#creating-notification-messages |
124 | 124 | */ |
125 | 125 | public function setFlash($message, $element = 'default', $params = array(), $key = 'flash') { |
126 | - CakeSession::write('Message.' . $key, compact('message', 'element', 'params')); |
|
126 | + CakeSession::write('Message.'.$key, compact('message', 'element', 'params')); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -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); |
@@ -99,15 +99,15 @@ |
||
99 | 99 | $component = $settings['className']; |
100 | 100 | } |
101 | 101 | list($plugin, $name) = pluginSplit($component, true); |
102 | - if (!isset($alias)) { |
|
102 | + if ( ! isset($alias)) { |
|
103 | 103 | $alias = $name; |
104 | 104 | } |
105 | 105 | if (isset($this->_loaded[$alias])) { |
106 | 106 | return $this->_loaded[$alias]; |
107 | 107 | } |
108 | - $componentClass = $name . 'Component'; |
|
109 | - App::uses($componentClass, $plugin . 'Controller/Component'); |
|
110 | - if (!class_exists($componentClass)) { |
|
108 | + $componentClass = $name.'Component'; |
|
109 | + App::uses($componentClass, $plugin.'Controller/Component'); |
|
110 | + if ( ! class_exists($componentClass)) { |
|
111 | 111 | throw new MissingComponentException(array( |
112 | 112 | 'class' => $componentClass, |
113 | 113 | 'plugin' => substr($plugin, 0, -1) |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | $config += array('bootstrap' => false, 'routes' => false, 'ignoreMissing' => false); |
77 | 77 | if (empty($config['path'])) { |
78 | 78 | foreach (App::path('plugins') as $path) { |
79 | - if (is_dir($path . $plugin)) { |
|
80 | - self::$_plugins[$plugin] = $config + array('path' => $path . $plugin . DS); |
|
79 | + if (is_dir($path.$plugin)) { |
|
80 | + self::$_plugins[$plugin] = $config + array('path' => $path.$plugin.DS); |
|
81 | 81 | break; |
82 | 82 | } |
83 | 83 | |
84 | 84 | //Backwards compatibility to make easier to migrate to 2.0 |
85 | 85 | $underscored = Inflector::underscore($plugin); |
86 | - if (is_dir($path . $underscored)) { |
|
87 | - self::$_plugins[$plugin] = $config + array('path' => $path . $underscored . DS); |
|
86 | + if (is_dir($path.$underscored)) { |
|
87 | + self::$_plugins[$plugin] = $config + array('path' => $path.$underscored.DS); |
|
88 | 88 | break; |
89 | 89 | } |
90 | 90 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | if (empty(self::$_plugins[$plugin]['path'])) { |
96 | 96 | throw new MissingPluginException(array('plugin' => $plugin)); |
97 | 97 | } |
98 | - if (!empty(self::$_plugins[$plugin]['bootstrap'])) { |
|
98 | + if ( ! empty(self::$_plugins[$plugin]['bootstrap'])) { |
|
99 | 99 | self::bootstrap($plugin); |
100 | 100 | } |
101 | 101 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | if ($opts === null && isset($options[0])) { |
126 | 126 | $opts = $options[0]; |
127 | 127 | } |
128 | - self::load($p, (array)$opts); |
|
128 | + self::load($p, (array) $opts); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | $path = self::path($plugin); |
163 | 163 | if ($config['bootstrap'] === true) { |
164 | 164 | return self::_includeFile( |
165 | - $path . 'Config' . DS . 'bootstrap.php', |
|
165 | + $path.'Config'.DS.'bootstrap.php', |
|
166 | 166 | $config['ignoreMissing'] |
167 | 167 | ); |
168 | 168 | } |
169 | 169 | |
170 | - $bootstrap = (array)$config['bootstrap']; |
|
170 | + $bootstrap = (array) $config['bootstrap']; |
|
171 | 171 | foreach ($bootstrap as $file) { |
172 | 172 | self::_includeFile( |
173 | - $path . 'Config' . DS . $file . '.php', |
|
173 | + $path.'Config'.DS.$file.'.php', |
|
174 | 174 | $config['ignoreMissing'] |
175 | 175 | ); |
176 | 176 | } |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | if ($config['routes'] === false) { |
197 | 197 | return false; |
198 | 198 | } |
199 | - return (bool)self::_includeFile( |
|
200 | - self::path($plugin) . 'Config' . DS . 'routes.php', |
|
199 | + return (bool) self::_includeFile( |
|
200 | + self::path($plugin).'Config'.DS.'routes.php', |
|
201 | 201 | $config['ignoreMissing'] |
202 | 202 | ); |
203 | 203 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @return mixed |
242 | 242 | */ |
243 | 243 | protected static function _includeFile($file, $ignoreMissing = false) { |
244 | - if ($ignoreMissing && !is_file($file)) { |
|
244 | + if ($ignoreMissing && ! is_file($file)) { |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | return include $file; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $renderer = isset($config['renderer']) ? $config['renderer'] : 'ExceptionRenderer'; |
114 | 114 | if ($renderer !== 'ExceptionRenderer') { |
115 | 115 | list($plugin, $renderer) = pluginSplit($renderer, true); |
116 | - App::uses($renderer, $plugin . 'Error'); |
|
116 | + App::uses($renderer, $plugin.'Error'); |
|
117 | 117 | } |
118 | 118 | try { |
119 | 119 | $error = new $renderer($exception); |
@@ -143,16 +143,16 @@ discard block |
||
143 | 143 | if (method_exists($exception, 'getAttributes')) { |
144 | 144 | $attributes = $exception->getAttributes(); |
145 | 145 | if ($attributes) { |
146 | - $message .= "\nException Attributes: " . var_export($exception->getAttributes(), true); |
|
146 | + $message .= "\nException Attributes: ".var_export($exception->getAttributes(), true); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | if (php_sapi_name() !== 'cli') { |
150 | 150 | $request = Router::getRequest(); |
151 | 151 | if ($request) { |
152 | - $message .= "\nRequest URL: " . $request->here(); |
|
152 | + $message .= "\nRequest URL: ".$request->here(); |
|
153 | 153 | } |
154 | 154 | } |
155 | - $message .= "\nStack Trace:\n" . $exception->getTraceAsString(); |
|
155 | + $message .= "\nStack Trace:\n".$exception->getTraceAsString(); |
|
156 | 156 | return $message; |
157 | 157 | } |
158 | 158 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | return false; |
169 | 169 | } |
170 | 170 | |
171 | - if (!empty($config['skipLog'])) { |
|
172 | - foreach ((array)$config['skipLog'] as $class) { |
|
171 | + if ( ! empty($config['skipLog'])) { |
|
172 | + foreach ((array) $config['skipLog'] as $class) { |
|
173 | 173 | if ($exception instanceof $class) { |
174 | 174 | return false; |
175 | 175 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | ); |
219 | 219 | return Debugger::getInstance()->outputError($data); |
220 | 220 | } |
221 | - $message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']'; |
|
222 | - if (!empty($errorConfig['trace'])) { |
|
221 | + $message = $error.' ('.$code.'): '.$description.' in ['.$file.', line '.$line.']'; |
|
222 | + if ( ! empty($errorConfig['trace'])) { |
|
223 | 223 | $trace = Debugger::trace(array('start' => 1, 'format' => 'log')); |
224 | - $message .= "\nTrace:\n" . $trace . "\n"; |
|
224 | + $message .= "\nTrace:\n".$trace."\n"; |
|
225 | 225 | } |
226 | 226 | return CakeLog::write($log, $message); |
227 | 227 | } |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * @return boolean |
237 | 237 | */ |
238 | 238 | public static function handleFatalError($code, $description, $file, $line) { |
239 | - $logMessage = 'Fatal Error (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']'; |
|
239 | + $logMessage = 'Fatal Error ('.$code.'): '.$description.' in ['.$file.', line '.$line.']'; |
|
240 | 240 | CakeLog::write(LOG_ERR, $logMessage); |
241 | 241 | |
242 | 242 | $exceptionHandler = Configure::read('Exception.handler'); |
243 | - if (!is_callable($exceptionHandler)) { |
|
243 | + if ( ! is_callable($exceptionHandler)) { |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | $methodExists = method_exists($this, $method); |
101 | 101 | |
102 | - if ($exception instanceof CakeException && !$methodExists) { |
|
102 | + if ($exception instanceof CakeException && ! $methodExists) { |
|
103 | 103 | $method = '_cakeError'; |
104 | 104 | if (empty($template) || $template === 'internalError') { |
105 | 105 | $template = 'error500'; |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | $method = 'pdoError'; |
109 | 109 | $template = 'pdo_error'; |
110 | 110 | $code = 500; |
111 | - } elseif (!$methodExists) { |
|
111 | + } elseif ( ! $methodExists) { |
|
112 | 112 | $method = 'error500'; |
113 | 113 | if ($code >= 400 && $code < 500) { |
114 | 114 | $method = 'error400'; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - $isNotDebug = !Configure::read('debug'); |
|
118 | + $isNotDebug = ! Configure::read('debug'); |
|
119 | 119 | if ($isNotDebug && $method === '_cakeError') { |
120 | 120 | $method = 'error400'; |
121 | 121 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | protected function _getController($exception) { |
140 | 140 | App::uses('AppController', 'Controller'); |
141 | 141 | App::uses('CakeErrorController', 'Controller'); |
142 | - if (!$request = Router::getRequest(true)) { |
|
142 | + if ( ! $request = Router::getRequest(true)) { |
|
143 | 143 | $request = new CakeRequest(); |
144 | 144 | } |
145 | 145 | $response = new CakeResponse(); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $controller = new CakeErrorController($request, $response); |
154 | 154 | $controller->startupProcess(); |
155 | 155 | } catch (Exception $e) { |
156 | - if (!empty($controller) && $controller->Components->enabled('RequestHandler')) { |
|
156 | + if ( ! empty($controller) && $controller->Components->enabled('RequestHandler')) { |
|
157 | 157 | $controller->RequestHandler->startup($controller); |
158 | 158 | } |
159 | 159 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function error400($error) { |
207 | 207 | $message = $error->getMessage(); |
208 | - if (!Configure::read('debug') && $error instanceof CakeException) { |
|
208 | + if ( ! Configure::read('debug') && $error instanceof CakeException) { |
|
209 | 209 | $message = __d('cake', 'Not Found'); |
210 | 210 | } |
211 | 211 | $url = $this->controller->request->here(); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function error500($error) { |
229 | 229 | $message = $error->getMessage(); |
230 | - if (!Configure::read('debug')) { |
|
230 | + if ( ! Configure::read('debug')) { |
|
231 | 231 | $message = __d('cake', 'An Internal Error Has Occurred.'); |
232 | 232 | } |
233 | 233 | $url = $this->controller->request->here(); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * |
61 | 61 | * @package Cake.Error |
62 | 62 | */ |
63 | -if (!class_exists('HttpException', false)) { |
|
63 | +if ( ! class_exists('HttpException', false)) { |
|
64 | 64 | class HttpException extends CakeBaseException { |
65 | 65 | } |
66 | 66 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * instance of CakeEventListener. |
101 | 101 | */ |
102 | 102 | public function attach($callable, $eventKey = null, $options = array()) { |
103 | - if (!$eventKey && !($callable instanceof CakeEventListener)) { |
|
103 | + if ( ! $eventKey && ! ($callable instanceof CakeEventListener)) { |
|
104 | 104 | throw new InvalidArgumentException(__d('cake_dev', 'The eventKey variable is required')); |
105 | 105 | } |
106 | 106 | if ($callable instanceof CakeEventListener) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return void |
123 | 123 | */ |
124 | 124 | protected function _attachSubscriber(CakeEventListener $subscriber) { |
125 | - foreach ((array)$subscriber->implementedEvents() as $eventKey => $function) { |
|
125 | + foreach ((array) $subscriber->implementedEvents() as $eventKey => $function) { |
|
126 | 126 | $options = array(); |
127 | 127 | $method = $function; |
128 | 128 | if (is_array($function) && isset($function['callable'])) { |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | * @return void |
198 | 198 | */ |
199 | 199 | protected function _detachSubscriber(CakeEventListener $subscriber, $eventKey = null) { |
200 | - $events = (array)$subscriber->implementedEvents(); |
|
201 | - if (!empty($eventKey) && empty($events[$eventKey])) { |
|
200 | + $events = (array) $subscriber->implementedEvents(); |
|
201 | + if ( ! empty($eventKey) && empty($events[$eventKey])) { |
|
202 | 202 | return; |
203 | - } elseif (!empty($eventKey)) { |
|
203 | + } elseif ( ! empty($eventKey)) { |
|
204 | 204 | $events = array($eventKey => $events[$eventKey]); |
205 | 205 | } |
206 | 206 | foreach ($events as $key => $function) { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $event = new CakeEvent($event); |
230 | 230 | } |
231 | 231 | |
232 | - if (!$this->_isGlobal) { |
|
232 | + if ( ! $this->_isGlobal) { |
|
233 | 233 | self::instance()->dispatch($event); |
234 | 234 | } |
235 | 235 |