Skip to content

Commit bf18fc4

Browse files
committed
cleaning up the code, removing extra variables set and un-needed else
1 parent 25b4471 commit bf18fc4

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

lib/Cake/Controller/Component/SecurityComponent.php

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ public function startup(Controller $controller) {
246246
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requirePost
247247
*/
248248
public function requirePost() {
249-
$args = func_get_args();
250-
$this->_requireMethod('Post', $args);
249+
$this->_requireMethod('Post', func_get_args());
251250
}
252251

253252
/**
@@ -256,8 +255,7 @@ public function requirePost() {
256255
* @return void
257256
*/
258257
public function requireGet() {
259-
$args = func_get_args();
260-
$this->_requireMethod('Get', $args);
258+
$this->_requireMethod('Get', func_get_args());
261259
}
262260

263261
/**
@@ -266,8 +264,7 @@ public function requireGet() {
266264
* @return void
267265
*/
268266
public function requirePut() {
269-
$args = func_get_args();
270-
$this->_requireMethod('Put', $args);
267+
$this->_requireMethod('Put', func_get_args());
271268
}
272269

273270
/**
@@ -276,8 +273,7 @@ public function requirePut() {
276273
* @return void
277274
*/
278275
public function requireDelete() {
279-
$args = func_get_args();
280-
$this->_requireMethod('Delete', $args);
276+
$this->_requireMethod('Delete', func_get_args());
281277
}
282278

283279
/**
@@ -287,8 +283,7 @@ public function requireDelete() {
287283
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requireSecure
288284
*/
289285
public function requireSecure() {
290-
$args = func_get_args();
291-
$this->_requireMethod('Secure', $args);
286+
$this->_requireMethod('Secure', func_get_args());
292287
}
293288

294289
/**
@@ -298,8 +293,7 @@ public function requireSecure() {
298293
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requireAuth
299294
*/
300295
public function requireAuth() {
301-
$args = func_get_args();
302-
$this->_requireMethod('Auth', $args);
296+
$this->_requireMethod('Auth', func_get_args());
303297
}
304298

305299
/**
@@ -316,9 +310,8 @@ public function requireAuth() {
316310
public function blackHole(Controller $controller, $error = '') {
317311
if ($this->blackHoleCallback == null) {
318312
throw new BadRequestException(__d('cake_dev', 'The request has been black-holed'));
319-
} else {
320-
return $this->_callback($controller, $this->blackHoleCallback, array($error));
321313
}
314+
return $this->_callback($controller, $this->blackHoleCallback, array($error));
322315
}
323316

324317
/**
@@ -593,11 +586,10 @@ protected function _expireTokens($tokens) {
593586
* @throws BadRequestException When a the blackholeCallback is not callable.
594587
*/
595588
protected function _callback(Controller $controller, $method, $params = array()) {
596-
if (is_callable(array($controller, $method))) {
597-
return call_user_func_array(array(&$controller, $method), empty($params) ? null : $params);
598-
} else {
589+
if (!is_callable(array($controller, $method))) {
599590
throw new BadRequestException(__d('cake_dev', 'The request has been black-holed'));
600591
}
592+
return call_user_func_array(array(&$controller, $method), empty($params) ? null : $params);
601593
}
602594

603595
}

0 commit comments

Comments
 (0)