compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (5)

View Page History
public function authenticate()
{
$adapters = $this->getAdapters();

$results = array();
$resultMessages = array();
foreach ($adapters as $adapter) {
// Validate adapter
if (!$adapter instanceof Zend_Auth_Adapter_Interface) {
/**
* @see Zym_Auth_Adapter_Exception
*/
require_once 'Zym/Auth/Adapter/Exception.php';
throw new Zym_Auth_Adapter_Exception(sprintf(
'Adapter "%s" is not an instance of Zend_Auth_Adapter_Interface',
get_class($adapter)));
}

$result = $adapter->authenticate();

// Success
if ($result->isValid()) {
$this->_lastSuccessfulAdapter = $adapter;

return $result;
}

// Failure
$results[] = $result;
$resultMessages[] = $result->getMessages();
}

$result = new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null, $resultMessages);

return $result;
}

public function getAdapters()
{
return $this->_adapters;
}

public function addAdapter(Zend_Auth_Adapter_Interface $adapter)
{
$this->_adapters[] = $adapter;
return $this;
}

public function setAdapters(array $adapters)
{
$this->_adapters = $adapters;
return $this;
}

public function getLastSuccessfulAdapter()
{
if (!$this->_lastSuccessfulAdapter instanceof Zend_Auth_Adapter_Interface) {
/**
* @see Zend_Auth_Adapter_Exception
*/
require_once 'Zend/Auth/Adapter/Exception.php';
throw new Zend_Auth_Adapter_Exception(
'No adapters have successfully authenticated'
);
}

return $this->_lastSuccessfulAdapter;
}
}