Skip to content

Commit

Permalink
Only return a single authenticate or authorize object
Browse files Browse the repository at this point in the history
  • Loading branch information
Walther Lalk committed Sep 1, 2014
1 parent 6ba5dfe commit c2452a7
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/Controller/Component/AuthComponent.php
Expand Up @@ -513,21 +513,17 @@ public function constructAuthorize() {
}

/**
* Getter for authorize objects. Will either return an array of all authorize objects, or a particular authorize object.
* Getter for authorize objects. Will return a particular authorize object.
*
* @param string|null $alias Alias for the authorize object
* @return \Cake\Auth\BaseAuthorize|array|null
* @param string $alias Alias for the authorize object
* @return \Cake\Auth\BaseAuthorize|null
*/
public function getAuthorize($alias = null) {
public function getAuthorize($alias) {
if (empty($this->_authorizeObjects)) {
$this->constructAuthorize();
}

if ($alias !== null && isset($this->_authorizeObjects[$alias])) {
return $this->_authorizeObjects[$alias];
}

return $alias === null ? $this->_authorizeObjects : null;
return isset($this->_authorizeObjects[$alias]) ? $this->_authorizeObjects[$alias] : null;
}

/**
Expand Down Expand Up @@ -778,22 +774,18 @@ public function constructAuthenticate() {
}

/**
* Getter for authenticate objects. Will either return an array of all authenticate objects, or a particular authenticate object.
* Getter for authenticate objects. Will return a particular authenticate object.
*
* @param string|null $alias Alias for the authenticate object
* @param string $alias Alias for the authenticate object
*
* @return \Cake\Auth\BaseAuthenticate|array|null
* @return \Cake\Auth\BaseAuthenticate|null
*/
public function getAuthenticate($alias = null) {
public function getAuthenticate($alias) {
if (empty($this->_authenticateObjects)) {
$this->constructAuthenticate();
}

if ($alias !== null && isset($this->_authenticateObjects[$alias])) {
return $this->_authenticateObjects[$alias];
}

return $alias === null ? $this->_authenticateObjects : null;
return isset($this->_authenticateObjects[$alias]) ? $this->_authenticateObjects[$alias] : null;
}

/**
Expand Down

0 comments on commit c2452a7

Please sign in to comment.