@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * @param bool $objectReturn |
| 26 | 26 | * @return mixed |
| 27 | 27 | */ |
| 28 | - public function login($credentials=array(),$objectReturn=false); |
|
| 28 | + public function login($credentials = array(), $objectReturn = false); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @return mixed |
@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - protected $using=false; |
|
| 15 | + protected $using = false; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * AuthLoginManager constructor. |
| 19 | 19 | * @param $credentials |
| 20 | 20 | * @param \Resta\Authenticate\AuthenticateProvider $auth |
| 21 | 21 | */ |
| 22 | - public function __construct($credentials,$auth) |
|
| 22 | + public function __construct($credentials, $auth) |
|
| 23 | 23 | {
|
| 24 | 24 | parent::__construct($auth); |
| 25 | 25 | |
| 26 | 26 | // where the control mechanism of the credentials |
| 27 | 27 | // values received from the user-defined yada config setting is made. |
| 28 | - $this->credentials=new AuthLoginCredentialsManager($this->getCredentials($credentials),$this->using); |
|
| 28 | + $this->credentials = new AuthLoginCredentialsManager($this->getCredentials($credentials), $this->using); |
|
| 29 | 29 | |
| 30 | 30 | //query login |
| 31 | 31 | $this->loginProcess(); |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | // if the user is not going to use the config setting, |
| 40 | 40 | // then in this case it can attempt to login by sending parameters |
| 41 | 41 | // as an array to the login method. |
| 42 | - if(is_array($credentials) && count($credentials)){
|
|
| 42 | + if (is_array($credentials) && count($credentials)) {
|
|
| 43 | 43 | |
| 44 | - $this->using=true; |
|
| 44 | + $this->using = true; |
|
| 45 | 45 | return $credentials; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -21,14 +21,14 @@ |
||
| 21 | 21 | public function __construct($auth) |
| 22 | 22 | {
|
| 23 | 23 | //authenticate instance |
| 24 | - $this->auth=$auth; |
|
| 24 | + $this->auth = $auth; |
|
| 25 | 25 | |
| 26 | 26 | // for the builder, we get the namespace value from the auth object. |
| 27 | 27 | // this namespace will take us to the query builder application. |
| 28 | - $driverBuilder=$this->auth->getDriverBuilderNamespace(); |
|
| 28 | + $driverBuilder = $this->auth->getDriverBuilderNamespace(); |
|
| 29 | 29 | |
| 30 | 30 | // we get the instance value of |
| 31 | 31 | // the imported builder object. |
| 32 | - $this->driverBuilderInstance=new $driverBuilder($auth); |
|
| 32 | + $this->driverBuilderInstance = new $driverBuilder($auth); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -14,31 +14,31 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @var null |
| 16 | 16 | */ |
| 17 | - protected $credentialHash=null; |
|
| 17 | + protected $credentialHash = null; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var $request |
| 21 | 21 | */ |
| 22 | - protected $request=null; |
|
| 22 | + protected $request = null; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * AuthLoginCredentialsManager constructor. |
| 26 | 26 | * @param $credentials |
| 27 | 27 | * @param bool $using |
| 28 | 28 | */ |
| 29 | - public function __construct($credentials,$using=false) |
|
| 29 | + public function __construct($credentials, $using = false) |
|
| 30 | 30 | {
|
| 31 | 31 | //get credentials as default |
| 32 | - $this->credentials=$credentials; |
|
| 32 | + $this->credentials = $credentials; |
|
| 33 | 33 | |
| 34 | 34 | //get credential hash |
| 35 | 35 | $this->setCredentialHash(); |
| 36 | 36 | |
| 37 | - if($using===false){
|
|
| 37 | + if ($using===false) {
|
|
| 38 | 38 | |
| 39 | 39 | // the request object will help you process |
| 40 | 40 | // the credentials and get them correctly. |
| 41 | - $this->request=new AuthenticateRequest($this->credentials); |
|
| 41 | + $this->request = new AuthenticateRequest($this->credentials); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | //request handle |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | {
|
| 71 | 71 | // with the request object we get |
| 72 | 72 | // the credentials values through the all method. |
| 73 | - $this->credentials=($this->request===null) ? $this->get() : $this->request->credentials($this->credentials); |
|
| 73 | + $this->credentials = ($this->request===null) ? $this->get() : $this->request->credentials($this->credentials); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | private function setCredentialHash() |
| 80 | 80 | {
|
| 81 | 81 | //set credential hash |
| 82 | - if(count($this->credentials)){
|
|
| 83 | - $this->credentialHash=md5(sha1(implode("|",$this->credentials)));
|
|
| 82 | + if (count($this->credentials)) {
|
|
| 83 | + $this->credentialHash = md5(sha1(implode("|", $this->credentials)));
|
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | * @param $auth |
| 15 | 15 | * @param $token |
| 16 | 16 | */ |
| 17 | - public function __construct($auth,$token) |
|
| 17 | + public function __construct($auth, $token) |
|
| 18 | 18 | {
|
| 19 | 19 | parent::__construct($auth); |
| 20 | 20 | |
| 21 | 21 | //token value received by client |
| 22 | - $this->token=$token; |
|
| 22 | + $this->token = $token; |
|
| 23 | 23 | |
| 24 | 24 | //query check |
| 25 | 25 | $this->checkProcess(); |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | * @param $auth |
| 15 | 15 | * @param $token |
| 16 | 16 | */ |
| 17 | - public function __construct($auth,$token) |
|
| 17 | + public function __construct($auth, $token) |
|
| 18 | 18 | {
|
| 19 | 19 | parent::__construct($auth); |
| 20 | 20 | |
| 21 | 21 | //token value received by client |
| 22 | - $this->token=$token; |
|
| 22 | + $this->token = $token; |
|
| 23 | 23 | |
| 24 | 24 | //query check |
| 25 | 25 | $this->logoutProcess(); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * @var null |
| 9 | 9 | */ |
| 10 | - public $credentialHash=null; |
|
| 10 | + public $credentialHash = null; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @return string |
@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | {
|
| 17 | 17 | // the absolute params property must be present |
| 18 | 18 | // in the object and the params value must be the builder key. |
| 19 | - if(property_exists($this,'params') and isset($this->params['builder'])){
|
|
| 19 | + if (property_exists($this, 'params') and isset($this->params['builder'])) {
|
|
| 20 | 20 | |
| 21 | 21 | // a real token will be generated after |
| 22 | 22 | // you get the first method of the query builder value. |
| 23 | - $authData=$this->params['data']; |
|
| 23 | + $authData = $this->params['data']; |
|
| 24 | 24 | |
| 25 | 25 | // we refer to the token closure feature on the config to enable |
| 26 | 26 | // the creation of user-based tokens on the application side. |
| 27 | - return $this->tokenForConfig($authData,function() use($authData){
|
|
| 27 | + return $this->tokenForConfig($authData, function() use($authData){
|
|
| 28 | 28 | return md5(sha1($authData->id.'__'.$this->credentialHash.'__'.time().'__'.fingerPrint())); |
| 29 | 29 | }); |
| 30 | 30 | } |
@@ -37,15 +37,15 @@ discard block |
||
| 37 | 37 | * @param callable $callback |
| 38 | 38 | * @return mixed |
| 39 | 39 | */ |
| 40 | - private function tokenForConfig($authData,callable $callback) |
|
| 40 | + private function tokenForConfig($authData, callable $callback) |
|
| 41 | 41 | {
|
| 42 | 42 | // we get the authenticate token value |
| 43 | 43 | // from the config values. |
| 44 | - $configToken=$this->getConfigToken(); |
|
| 44 | + $configToken = $this->getConfigToken(); |
|
| 45 | 45 | |
| 46 | 46 | // if the token value is a closure value, |
| 47 | 47 | // we will run a user-based token closure. |
| 48 | - if(is_callable($configToken)){
|
|
| 48 | + if (is_callable($configToken)) {
|
|
| 49 | 49 | return $configToken($authData); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function __construct($auth) |
| 23 | 23 | {
|
| 24 | 24 | //authenticate instance |
| 25 | - $this->auth=$auth; |
|
| 25 | + $this->auth = $auth; |
|
| 26 | 26 | |
| 27 | 27 | parent::__construct(); |
| 28 | 28 | } |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | {
|
| 35 | 35 | // using the driver object we write the query builder statement. |
| 36 | 36 | // we do the values of the query with the token that are sent. |
| 37 | - $query=$this->checkQuery($token); |
|
| 37 | + $query = $this->checkQuery($token); |
|
| 38 | 38 | |
| 39 | 39 | // with query we bind the returned values to the params property of the auth object. |
| 40 | 40 | // and so the auth object will make a final return with these values. |
| 41 | - $this->paramValues('check',$query);
|
|
| 41 | + $this->paramValues('check', $query);
|
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | {
|
| 50 | 50 | // using the driver object we write the query builder statement. |
| 51 | 51 | // we do the values of the query with the credentials that are sent. |
| 52 | - $query=$this->setQuery($credentials); |
|
| 52 | + $query = $this->setQuery($credentials); |
|
| 53 | 53 | |
| 54 | 54 | // with query we bind the returned values to the params property of the auth object. |
| 55 | 55 | // and so the auth object will make a final return with these values. |
| 56 | - $this->paramValues('login',$query);
|
|
| 56 | + $this->paramValues('login', $query);
|
|
| 57 | 57 | |
| 58 | 58 | // we assign the credential hash value |
| 59 | 59 | // to the global of the authenticate object. |
| 60 | - $this->auth->credentialHash=$credentials->getCredentialHash(); |
|
| 60 | + $this->auth->credentialHash = $credentials->getCredentialHash(); |
|
| 61 | 61 | |
| 62 | 62 | // when the query succeeds, |
| 63 | 63 | // we update the token value. |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | {
|
| 72 | 72 | // using the driver object we write the query builder statement. |
| 73 | 73 | // we do the values of the query with the token that are sent. |
| 74 | - $query=$this->logoutQuery($token); |
|
| 74 | + $query = $this->logoutQuery($token); |
|
| 75 | 75 | |
| 76 | 76 | // with query we bind the returned values to the params property of the auth object. |
| 77 | 77 | // and so the auth object will make a final return with these values. |
| 78 | - $this->paramValues('logout',$query);
|
|
| 78 | + $this->paramValues('logout', $query);
|
|
| 79 | 79 | |
| 80 | 80 | //token updating as null |
| 81 | 81 | $this->updateToken(md5(time())); |
@@ -8,5 +8,5 @@ |
||
| 8 | 8 | /** |
| 9 | 9 | * @var $table string |
| 10 | 10 | */ |
| 11 | - protected $table='users'; |
|
| 11 | + protected $table = 'users'; |
|
| 12 | 12 | } |