Source of file Result.php
Size: 2,703 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Authentication/Result.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Authentication; class Result { /** * General Failure */ const FAILURE = 0; /** * Failure due to identity not being found. */ const FAILURE_IDENTITY_NOT_FOUND = -1; /** * Failure due to identity being ambiguous. */ const FAILURE_IDENTITY_AMBIGUOUS = -2; /** * Failure due to invalid credential being supplied. */ const FAILURE_CREDENTIAL_INVALID = -3; /** * Failure due to uncategorized reasons. */ const FAILURE_UNCATEGORIZED = -4; /** * Authentication success. */ const SUCCESS = 1; /** * Authentication result code * * @var int */ protected $code; /** * The identity used in the authentication attempt * * @var mixed */ protected $identity; /** * An array of string reasons why the authentication attempt was unsuccessful * * If authentication was successful, this should be an empty array. * * @var array */ protected $messages; /** * Sets the result code, identity, and failure messages * * @param int $code * @param mixed $identity * @param array $messages */ public function __construct($code, $identity, array $messages = array()) { $this->code = (int) $code; $this->identity = $identity; $this->messages = $messages; } /** * Returns whether the result represents a successful authentication attempt * * @return bool */ public function isValid() { return ($this->code > 0) ? true : false; } /** * getCode() - Get the result code for this authentication attempt * * @return int */ public function getCode() { return $this->code; } /** * Returns the identity used in the authentication attempt * * @return mixed */ public function getIdentity() { return $this->identity; } /** * Returns an array of string reasons why the authentication attempt was unsuccessful * * If authentication was successful, this method returns an empty array. * * @return array */ public function getMessages() { return $this->messages; } } |