| 1 | <?php |
||
| 5 | class AuthException extends \Exception |
||
| 6 | { |
||
| 7 | private $reasons = []; |
||
| 8 | |||
| 9 | /** @var string */ |
||
| 10 | private $type = ''; |
||
| 11 | |||
| 12 | public function __construct($type = '') |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Returns the collection of reasons. Can be empty. |
||
| 19 | * |
||
| 20 | * @return array |
||
| 21 | */ |
||
| 22 | public function getReasons() : array |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Adds a reason to the reason bag in the exception |
||
| 29 | * |
||
| 30 | * @param Reason $reason |
||
| 31 | * @return AuthException |
||
| 32 | */ |
||
| 33 | public function addReason(Reason $reason) : AuthException |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Checks if any reasons have been defined in the exception |
||
| 41 | * |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | public function hasReasons() : bool |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Sets the context in which the exception was thrown |
||
| 51 | * |
||
| 52 | * Example "ban" or "and" |
||
| 53 | * |
||
| 54 | * @param string $type |
||
| 55 | * @return AuthException |
||
| 56 | */ |
||
| 57 | public function setType(string $type) : AuthException |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Returns context in which exception occurred. |
||
| 65 | * |
||
| 66 | * Example "ban" or "and" |
||
| 67 | * |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | public function getType() : string |
||
| 74 | } |
||
| 75 |