Archived
1
0
Fork 0

adding app/library/Auth/Result.php

This commit is contained in:
Henrik Hautakoski 2018-08-17 16:51:41 +02:00
parent fe542461f7
commit d4902331cf
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA

View file

@ -0,0 +1,53 @@
<?php
namespace Httpcb\Auth;
/**
* Class Result
* @package Httpcb\Auth
*/
class Result
{
/**
* Codes
*/
const SUCCESS = 1;
const FAILURE_INVALID_CREDENTIALS = -1;
const FAILURE_IDENTITY_NOT_FOUND = -2;
const FAILURE_ACCOUNT_SUSPENDED = -3;
/**
* @var int
*/
protected $_code;
/**
* Constructor
*
* @param $code
*/
public function __construct($code)
{
$this->_code = (int) $code;
}
/**
* Get the result code for this authentication attempt.
*
* @return int
*/
public function getCode()
{
return $this->_code;
}
/**
* Returns true if the authentication was sucessfull, false otherwise.
*
* @return bool
*/
public function isValid()
{
return $this->_code == self::SUCCESS;
}
}