Completed
Push — master ( 256a55...3c651b )
by Reginaldo
31:32 queued 13:53
created
lib/Cake/Controller/CakeErrorController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 		parent::__construct($request, $response);
47 47
 		$this->constructClasses();
48 48
 		if (count(Router::extensions()) &&
49
-			!$this->Components->attached('RequestHandler')
49
+			! $this->Components->attached('RequestHandler')
50 50
 		) {
51 51
 			$this->RequestHandler = $this->Components->load('RequestHandler');
52 52
 		}
Please login to merge, or discard this patch.
lib/Cake/Controller/Component.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$this->_Collection = $collection;
80 80
 		$this->settings = $settings;
81 81
 		$this->_set($settings);
82
-		if (!empty($this->components)) {
82
+		if ( ! empty($this->components)) {
83 83
 			$this->_componentMap = ComponentCollection::normalizeObjectArray($this->components);
84 84
 		}
85 85
 	}
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
  * @return mixed A Component object or null.
92 92
  */
93 93
 	public function __get($name) {
94
-		if (isset($this->_componentMap[$name]) && !isset($this->{$name})) {
95
-			$settings = array_merge((array)$this->_componentMap[$name]['settings'], array('enabled' => false));
94
+		if (isset($this->_componentMap[$name]) && ! isset($this->{$name})) {
95
+			$settings = array_merge((array) $this->_componentMap[$name]['settings'], array('enabled' => false));
96 96
 			$this->{$name} = $this->_Collection->load($this->_componentMap[$name]['class'], $settings);
97 97
 		}
98 98
 		if (isset($this->{$name})) {
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
  *
74 74
  * @param string $behavior
75 75
  * @param array $config
76
- * @return void
76
+ * @return boolean
77 77
  * @deprecated Will be removed in 3.0. Replaced with load().
78 78
  */
79 79
 	public function attach($behavior, $config = array()) {
Please login to merge, or discard this patch.
lib/Cake/Controller/Component/AclComponent.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 	public function __construct(ComponentCollection $collection, $settings = array()) {
61 61
 		parent::__construct($collection, $settings);
62 62
 		$name = Configure::read('Acl.classname');
63
-		if (!class_exists($name)) {
63
+		if ( ! class_exists($name)) {
64 64
 			list($plugin, $name) = pluginSplit($name, true);
65
-			App::uses($name, $plugin . 'Controller/Component/Acl');
66
-			if (!class_exists($name)) {
65
+			App::uses($name, $plugin.'Controller/Component/Acl');
66
+			if ( ! class_exists($name)) {
67 67
 				throw new CakeException(__d('cake_dev', 'Could not find %s.', $name));
68 68
 			}
69 69
 		}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			if (is_string($adapter)) {
88 88
 				$adapter = new $adapter();
89 89
 			}
90
-			if (!$adapter instanceof AclInterface) {
90
+			if ( ! $adapter instanceof AclInterface) {
91 91
 				throw new CakeException(__d('cake_dev', 'AclComponent adapters must implement AclInterface'));
92 92
 			}
93 93
 			$this->_Instance = $adapter;
Please login to merge, or discard this patch.
lib/Cake/Controller/Component/Auth/BaseAuthorize.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
  */
94 94
 	public function controller(Controller $controller = null) {
95 95
 		if ($controller) {
96
-			if (!$controller instanceof Controller) {
96
+			if ( ! $controller instanceof Controller) {
97 97
 				throw new CakeException(__d('cake_dev', '$controller needs to be an instance of Controller'));
98 98
 			}
99 99
 			$this->_Controller = $controller;
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
  * @return string the action path for the given request.
112 112
  */
113 113
 	public function action(CakeRequest $request, $path = '/:plugin/:controller/:action') {
114
-		$plugin = empty($request['plugin']) ? null : Inflector::camelize($request['plugin']) . '/';
114
+		$plugin = empty($request['plugin']) ? null : Inflector::camelize($request['plugin']).'/';
115 115
 		$path = str_replace(
116 116
 			array(':controller', ':action', ':plugin/'),
117 117
 			array(Inflector::camelize($request['controller']), $request['action'], $plugin),
118
-			$this->settings['actionPath'] . $path
118
+			$this->settings['actionPath'].$path
119 119
 		);
120 120
 		$path = str_replace('//', '/', $path);
121 121
 		return trim($path, '/');
Please login to merge, or discard this patch.
lib/Cake/Controller/Component/Auth/ControllerAuthorize.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  */
48 48
 	public function controller(Controller $controller = null) {
49 49
 		if ($controller) {
50
-			if (!method_exists($controller, 'isAuthorized')) {
50
+			if ( ! method_exists($controller, 'isAuthorized')) {
51 51
 				throw new CakeException(__d('cake_dev', '$controller does not implement an %s method.', 'isAuthorized()'));
52 52
 			}
53 53
 		}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  * @return boolean
63 63
  */
64 64
 	public function authorize($user, CakeRequest $request) {
65
-		return (bool)$this->_Controller->isAuthorized($user);
65
+		return (bool) $this->_Controller->isAuthorized($user);
66 66
 	}
67 67
 
68 68
 }
Please login to merge, or discard this patch.
lib/Cake/Controller/Component/Auth/CrudAuthorize.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
 		$map = array_combine($crud, $crud);
56 56
 
57 57
 		$prefixes = Router::prefixes();
58
-		if (!empty($prefixes)) {
58
+		if ( ! empty($prefixes)) {
59 59
 			foreach ($prefixes as $prefix) {
60 60
 				$map = array_merge($map, array(
61
-					$prefix . '_index' => 'read',
62
-					$prefix . '_add' => 'create',
63
-					$prefix . '_edit' => 'update',
64
-					$prefix . '_view' => 'read',
65
-					$prefix . '_remove' => 'delete',
66
-					$prefix . '_create' => 'create',
67
-					$prefix . '_read' => 'read',
68
-					$prefix . '_update' => 'update',
69
-					$prefix . '_delete' => 'delete'
61
+					$prefix.'_index' => 'read',
62
+					$prefix.'_add' => 'create',
63
+					$prefix.'_edit' => 'update',
64
+					$prefix.'_view' => 'read',
65
+					$prefix.'_remove' => 'delete',
66
+					$prefix.'_create' => 'create',
67
+					$prefix.'_read' => 'read',
68
+					$prefix.'_update' => 'update',
69
+					$prefix.'_delete' => 'delete'
70 70
 				));
71 71
 			}
72 72
 		}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
  * @return boolean
82 82
  */
83 83
 	public function authorize($user, CakeRequest $request) {
84
-		if (!isset($this->settings['actionMap'][$request->params['action']])) {
84
+		if ( ! isset($this->settings['actionMap'][$request->params['action']])) {
85 85
 			trigger_error(__d('cake_dev',
86 86
 				'CrudAuthorize::authorize() - Attempted access of un-mapped action "%1$s" in controller "%2$s"',
87 87
 				$request->action,
Please login to merge, or discard this patch.
lib/Cake/Controller/Component/Auth/DigestAuthenticate.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 		list(, $model) = pluginSplit($this->settings['userModel']);
122 122
 		$user = $this->_findUser(array(
123
-			$model . '.' . $this->settings['fields']['username'] => $digest['username']
123
+			$model.'.'.$this->settings['fields']['username'] => $digest['username']
124 124
 		));
125 125
 		if (empty($user)) {
126 126
 			return false;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$digest = env('PHP_AUTH_DIGEST');
143 143
 		if (empty($digest) && function_exists('apache_request_headers')) {
144 144
 			$headers = apache_request_headers();
145
-			if (!empty($headers['Authorization']) && substr($headers['Authorization'], 0, 7) === 'Digest ') {
145
+			if ( ! empty($headers['Authorization']) && substr($headers['Authorization'], 0, 7) === 'Digest ') {
146 146
 				$digest = substr($headers['Authorization'], 7);
147 147
 			}
148 148
 		}
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
  */
187 187
 	public function generateResponseHash($digest, $password) {
188 188
 		return md5(
189
-			$password .
190
-			':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':' .
191
-			md5(env('REQUEST_METHOD') . ':' . $digest['uri'])
189
+			$password.
190
+			':'.$digest['nonce'].':'.$digest['nc'].':'.$digest['cnonce'].':'.$digest['qop'].':'.
191
+			md5(env('REQUEST_METHOD').':'.$digest['uri'])
192 192
 		);
193 193
 	}
194 194
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
  * @return string the hashed password that can later be used with Digest authentication.
202 202
  */
203 203
 	public static function password($username, $password, $realm) {
204
-		return md5($username . ':' . $realm . ':' . $password);
204
+		return md5($username.':'.$realm.':'.$password);
205 205
 	}
206 206
 
207 207
 /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		foreach ($options as $k => $v) {
221 221
 			$opts[] = sprintf('%s="%s"', $k, $v);
222 222
 		}
223
-		return 'WWW-Authenticate: Digest ' . implode(',', $opts);
223
+		return 'WWW-Authenticate: Digest '.implode(',', $opts);
224 224
 	}
225 225
 
226 226
 }
Please login to merge, or discard this patch.
lib/Cake/Controller/Component/Auth/FormAuthenticate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 			return false;
51 51
 		}
52 52
 		foreach (array($fields['username'], $fields['password']) as $field) {
53
-			$value = $request->data($model . '.' . $field);
54
-			if (empty($value) || !is_string($value)) {
53
+			$value = $request->data($model.'.'.$field);
54
+			if (empty($value) || ! is_string($value)) {
55 55
 				return false;
56 56
 			}
57 57
 		}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		list(, $model) = pluginSplit($userModel);
73 73
 
74 74
 		$fields = $this->settings['fields'];
75
-		if (!$this->_checkFields($request, $model, $fields)) {
75
+		if ( ! $this->_checkFields($request, $model, $fields)) {
76 76
 			return false;
77 77
 		}
78 78
 		return $this->_findUser(
Please login to merge, or discard this patch.
lib/Cake/Controller/Component/AuthComponent.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 
286 286
 		$isMissingAction = (
287 287
 			$controller->scaffold === false &&
288
-			!isset($methods[$action])
288
+			! isset($methods[$action])
289 289
 		);
290 290
 
291 291
 		if ($isMissingAction) {
292 292
 			return true;
293 293
 		}
294 294
 
295
-		if (!$this->_setDefaults()) {
295
+		if ( ! $this->_setDefaults()) {
296 296
 			return false;
297 297
 		}
298 298
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			return true;
301 301
 		}
302 302
 
303
-		if (!$this->_getUser()) {
303
+		if ( ! $this->_getUser()) {
304 304
 			return $this->_unauthenticated($controller);
305 305
 		}
306 306
 
@@ -351,20 +351,20 @@  discard block
 block discarded – undo
351 351
 
352 352
 		if ($this->_isLoginAction($controller)) {
353 353
 			if (empty($controller->request->data)) {
354
-				if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
354
+				if ( ! $this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
355 355
 					$this->Session->write('Auth.redirect', $controller->referer(null, true));
356 356
 				}
357 357
 			}
358 358
 			return true;
359 359
 		}
360 360
 
361
-		if (!$controller->request->is('ajax')) {
361
+		if ( ! $controller->request->is('ajax')) {
362 362
 			$this->flash($this->authError);
363 363
 			$this->Session->write('Auth.redirect', $controller->request->here(false));
364 364
 			$controller->redirect($this->loginAction);
365 365
 			return false;
366 366
 		}
367
-		if (!empty($this->ajaxLogin)) {
367
+		if ( ! empty($this->ajaxLogin)) {
368 368
 			$controller->viewPath = 'Elements';
369 369
 			echo $controller->render($this->ajaxLogin, $this->RequestHandler->ajaxLayout);
370 370
 			$this->_stop();
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		$this->flash($this->authError);
408 408
 		if ($this->unauthorizedRedirect === true) {
409 409
 			$default = '/';
410
-			if (!empty($this->loginRedirect)) {
410
+			if ( ! empty($this->loginRedirect)) {
411 411
 				$default = $this->loginRedirect;
412 412
 			}
413 413
 			$url = $controller->referer($default, true);
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 			'authError' => __d('cake', 'You are not authorized to access that location.')
430 430
 		);
431 431
 		foreach ($defaults as $key => $value) {
432
-			if (!isset($this->{$key}) || $this->{$key} === true) {
432
+			if ( ! isset($this->{$key}) || $this->{$key} === true) {
433 433
 				$this->{$key} = $value;
434 434
 			}
435 435
 		}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
  * @return boolean True if $user is authorized, otherwise false
449 449
  */
450 450
 	public function isAuthorized($user = null, CakeRequest $request = null) {
451
-		if (empty($user) && !$this->user()) {
451
+		if (empty($user) && ! $this->user()) {
452 452
 			return false;
453 453
 		}
454 454
 		if (empty($user)) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 			return;
480 480
 		}
481 481
 		$this->_authorizeObjects = array();
482
-		$config = Hash::normalize((array)$this->authorize);
482
+		$config = Hash::normalize((array) $this->authorize);
483 483
 		$global = array();
484 484
 		if (isset($config[AuthComponent::ALL])) {
485 485
 			$global = $config[AuthComponent::ALL];
@@ -487,15 +487,15 @@  discard block
 block discarded – undo
487 487
 		}
488 488
 		foreach ($config as $class => $settings) {
489 489
 			list($plugin, $class) = pluginSplit($class, true);
490
-			$className = $class . 'Authorize';
491
-			App::uses($className, $plugin . 'Controller/Component/Auth');
492
-			if (!class_exists($className)) {
490
+			$className = $class.'Authorize';
491
+			App::uses($className, $plugin.'Controller/Component/Auth');
492
+			if ( ! class_exists($className)) {
493 493
 				throw new CakeException(__d('cake_dev', 'Authorization adapter "%s" was not found.', $class));
494 494
 			}
495
-			if (!method_exists($className, 'authorize')) {
495
+			if ( ! method_exists($className, 'authorize')) {
496 496
 				throw new CakeException(__d('cake_dev', 'Authorization objects must implement an %s method.', 'authorize()'));
497 497
 			}
498
-			$settings = array_merge($global, (array)$settings);
498
+			$settings = array_merge($global, (array) $settings);
499 499
 			$this->_authorizeObjects[] = new $className($this->_Collection, $settings);
500 500
 		}
501 501
 		return $this->_authorizeObjects;
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
  * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#accessing-the-logged-in-user
646 646
  */
647 647
 	public static function user($key = null) {
648
-		if (!empty(self::$_user)) {
648
+		if ( ! empty(self::$_user)) {
649 649
 			$user = self::$_user;
650 650
 		} elseif (self::$sessionKey && CakeSession::check(self::$sessionKey)) {
651 651
 			$user = CakeSession::read(self::$sessionKey);
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 		}
677 677
 		foreach ($this->_authenticateObjects as $auth) {
678 678
 			$result = $auth->getUser($this->request);
679
-			if (!empty($result) && is_array($result)) {
679
+			if ( ! empty($result) && is_array($result)) {
680 680
 				self::$_user = $result;
681 681
 				return true;
682 682
 			}
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 		}
751 751
 		foreach ($this->_authenticateObjects as $auth) {
752 752
 			$result = $auth->authenticate($request, $response);
753
-			if (!empty($result) && is_array($result)) {
753
+			if ( ! empty($result) && is_array($result)) {
754 754
 				return $result;
755 755
 			}
756 756
 		}
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 			return;
769 769
 		}
770 770
 		$this->_authenticateObjects = array();
771
-		$config = Hash::normalize((array)$this->authenticate);
771
+		$config = Hash::normalize((array) $this->authenticate);
772 772
 		$global = array();
773 773
 		if (isset($config[AuthComponent::ALL])) {
774 774
 			$global = $config[AuthComponent::ALL];
@@ -776,15 +776,15 @@  discard block
 block discarded – undo
776 776
 		}
777 777
 		foreach ($config as $class => $settings) {
778 778
 			list($plugin, $class) = pluginSplit($class, true);
779
-			$className = $class . 'Authenticate';
780
-			App::uses($className, $plugin . 'Controller/Component/Auth');
781
-			if (!class_exists($className)) {
779
+			$className = $class.'Authenticate';
780
+			App::uses($className, $plugin.'Controller/Component/Auth');
781
+			if ( ! class_exists($className)) {
782 782
 				throw new CakeException(__d('cake_dev', 'Authentication adapter "%s" was not found.', $class));
783 783
 			}
784
-			if (!method_exists($className, 'authenticate')) {
784
+			if ( ! method_exists($className, 'authenticate')) {
785 785
 				throw new CakeException(__d('cake_dev', 'Authentication objects must implement an %s method.', 'authenticate()'));
786 786
 			}
787
-			$settings = array_merge($global, (array)$settings);
787
+			$settings = array_merge($global, (array) $settings);
788 788
 			$this->_authenticateObjects[] = new $className($this->_Collection, $settings);
789 789
 		}
790 790
 		return $this->_authenticateObjects;
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
  * @return boolean true if the user is logged in, false otherwise
811 811
  */
812 812
 	public function loggedIn() {
813
-		return (bool)$this->user();
813
+		return (bool) $this->user();
814 814
 	}
815 815
 
816 816
 /**
Please login to merge, or discard this patch.