Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Authentication / Result.php
blob954aec5a1a0a7f756a5783cbe04dcb8c2544d11c
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Authentication;
12 class Result
14 /**
15 * General Failure
17 const FAILURE = 0;
19 /**
20 * Failure due to identity not being found.
22 const FAILURE_IDENTITY_NOT_FOUND = -1;
24 /**
25 * Failure due to identity being ambiguous.
27 const FAILURE_IDENTITY_AMBIGUOUS = -2;
29 /**
30 * Failure due to invalid credential being supplied.
32 const FAILURE_CREDENTIAL_INVALID = -3;
34 /**
35 * Failure due to uncategorized reasons.
37 const FAILURE_UNCATEGORIZED = -4;
39 /**
40 * Authentication success.
42 const SUCCESS = 1;
44 /**
45 * Authentication result code
47 * @var int
49 protected $code;
51 /**
52 * The identity used in the authentication attempt
54 * @var mixed
56 protected $identity;
58 /**
59 * An array of string reasons why the authentication attempt was unsuccessful
61 * If authentication was successful, this should be an empty array.
63 * @var array
65 protected $messages;
67 /**
68 * Sets the result code, identity, and failure messages
70 * @param int $code
71 * @param mixed $identity
72 * @param array $messages
74 public function __construct($code, $identity, array $messages = array())
76 $this->code = (int) $code;
77 $this->identity = $identity;
78 $this->messages = $messages;
81 /**
82 * Returns whether the result represents a successful authentication attempt
84 * @return bool
86 public function isValid()
88 return ($this->code > 0) ? true : false;
91 /**
92 * getCode() - Get the result code for this authentication attempt
94 * @return int
96 public function getCode()
98 return $this->code;
102 * Returns the identity used in the authentication attempt
104 * @return mixed
106 public function getIdentity()
108 return $this->identity;
112 * Returns an array of string reasons why the authentication attempt was unsuccessful
114 * If authentication was successful, this method returns an empty array.
116 * @return array
118 public function getMessages()
120 return $this->messages;