Skip to content

Commit

Permalink
Merge pull request #838 from dogmatic69/security-component-cleanup
Browse files Browse the repository at this point in the history
cleaning up the code, removing extra variables set and un-needed else
  • Loading branch information
markstory committed Sep 13, 2012
2 parents f22d4c0 + bf18fc4 commit 51e0715
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions lib/Cake/Controller/Component/SecurityComponent.php
Expand Up @@ -246,8 +246,7 @@ public function startup(Controller $controller) {
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requirePost * @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requirePost
*/ */
public function requirePost() { public function requirePost() {
$args = func_get_args(); $this->_requireMethod('Post', func_get_args());
$this->_requireMethod('Post', $args);
} }


/** /**
Expand All @@ -256,8 +255,7 @@ public function requirePost() {
* @return void * @return void
*/ */
public function requireGet() { public function requireGet() {
$args = func_get_args(); $this->_requireMethod('Get', func_get_args());
$this->_requireMethod('Get', $args);
} }


/** /**
Expand All @@ -266,8 +264,7 @@ public function requireGet() {
* @return void * @return void
*/ */
public function requirePut() { public function requirePut() {
$args = func_get_args(); $this->_requireMethod('Put', func_get_args());
$this->_requireMethod('Put', $args);
} }


/** /**
Expand All @@ -276,8 +273,7 @@ public function requirePut() {
* @return void * @return void
*/ */
public function requireDelete() { public function requireDelete() {
$args = func_get_args(); $this->_requireMethod('Delete', func_get_args());
$this->_requireMethod('Delete', $args);
} }


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


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


/** /**
Expand All @@ -316,9 +310,8 @@ public function requireAuth() {
public function blackHole(Controller $controller, $error = '') { public function blackHole(Controller $controller, $error = '') {
if ($this->blackHoleCallback == null) { if ($this->blackHoleCallback == null) {
throw new BadRequestException(__d('cake_dev', 'The request has been black-holed')); throw new BadRequestException(__d('cake_dev', 'The request has been black-holed'));
} else {
return $this->_callback($controller, $this->blackHoleCallback, array($error));
} }
return $this->_callback($controller, $this->blackHoleCallback, array($error));
} }


/** /**
Expand Down Expand Up @@ -593,11 +586,10 @@ protected function _expireTokens($tokens) {
* @throws BadRequestException When a the blackholeCallback is not callable. * @throws BadRequestException When a the blackholeCallback is not callable.
*/ */
protected function _callback(Controller $controller, $method, $params = array()) { protected function _callback(Controller $controller, $method, $params = array()) {
if (is_callable(array($controller, $method))) { if (!is_callable(array($controller, $method))) {
return call_user_func_array(array(&$controller, $method), empty($params) ? null : $params);
} else {
throw new BadRequestException(__d('cake_dev', 'The request has been black-holed')); throw new BadRequestException(__d('cake_dev', 'The request has been black-holed'));
} }
return call_user_func_array(array(&$controller, $method), empty($params) ? null : $params);
} }


} }

0 comments on commit 51e0715

Please sign in to comment.