@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | $this->config(); |
40 | 40 | |
41 | - if($this->guard=="default"){ |
|
41 | + if ($this->guard=="default") { |
|
42 | 42 | $this->setAuthenticateNeeds(); |
43 | 43 | } |
44 | 44 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function getAddToWhere() |
64 | 64 | { |
65 | - if(isset($this->config['guard'][$this->guard]['addToWhere'])){ |
|
65 | + if (isset($this->config['guard'][$this->guard]['addToWhere'])) { |
|
66 | 66 | return $this->config['guard'][$this->guard]['addToWhere']; |
67 | 67 | } |
68 | 68 | return null; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getConfigToken() |
77 | 77 | { |
78 | - if(isset($this->config['guard'][$this->guard]['token'])){ |
|
78 | + if (isset($this->config['guard'][$this->guard]['token'])) { |
|
79 | 79 | return $this->config['guard'][$this->guard]['token']; |
80 | 80 | } |
81 | 81 | return null; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | $model = $this->getModel(); |
102 | 102 | |
103 | - if($model=="Default"){ |
|
103 | + if ($model=="Default") { |
|
104 | 104 | |
105 | 105 | return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\UserBuilder'; |
106 | 106 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $this->getModel(); |
127 | 127 | |
128 | - if($this->model=="Default"){ |
|
128 | + if ($this->model=="Default") { |
|
129 | 129 | |
130 | 130 | return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\User'; |
131 | 131 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param $credentials |
32 | 32 | * @param null|AuthLoginManager $manager |
33 | 33 | */ |
34 | - public function __construct($credentials,$manager) |
|
34 | + public function __construct($credentials, $manager) |
|
35 | 35 | { |
36 | 36 | //get credentials as default |
37 | 37 | $this->credentials = $credentials; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | //get credential hash |
43 | 43 | $this->setCredentialHash(); |
44 | 44 | |
45 | - if($this->manager->getUsing()===false){ |
|
45 | + if ($this->manager->getUsing()===false) { |
|
46 | 46 | |
47 | 47 | // the request object will help you process |
48 | 48 | // the credentials and get them correctly. |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | $request = $this->manager->getAuth()->getRequest(); |
96 | 96 | |
97 | - if($request=='Default'){ |
|
97 | + if ($request=='Default') { |
|
98 | 98 | return new AuthenticateRequest($this); |
99 | 99 | } |
100 | 100 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | private function setCredentialHash() |
123 | 123 | { |
124 | 124 | //set credential hash |
125 | - if(count($this->credentials)){ |
|
126 | - $this->credentialHash = md5(sha1(implode("|",$this->credentials))); |
|
125 | + if (count($this->credentials)) { |
|
126 | + $this->credentialHash = md5(sha1(implode("|", $this->credentials))); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
130 | 130 | \ No newline at end of file |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | * @param $credentials |
20 | 20 | * @param $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); |
|
28 | + $this->credentials = new AuthLoginCredentialsManager($this->getCredentials($credentials), $this); |
|
29 | 29 | |
30 | 30 | //query login |
31 | 31 | $this->loginProcess(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | // if the user is not going to use the config setting, |
42 | 42 | // then in this case it can attempt to login by sending parameters |
43 | 43 | // as an array to the login method. |
44 | - if(is_array($credentials) && count($credentials)){ |
|
44 | + if (is_array($credentials) && count($credentials)) { |
|
45 | 45 | |
46 | 46 | $this->using = true; |
47 | 47 | return $credentials; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | // if the auth value does not carry |
27 | 27 | // the authenticateProvider instance value, an exception is thrown. |
28 | - if(!$auth instanceof AuthenticateProvider){ |
|
28 | + if (!$auth instanceof AuthenticateProvider) { |
|
29 | 29 | exception()->runtime('AuthenticateProvider instance is not valid'); |
30 | 30 | } |
31 | 31 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // the imported builder object. |
41 | 41 | $this->driverBuilderInstance = new $driverBuilder($auth); |
42 | 42 | |
43 | - if(!$this->driverBuilderInstance instanceof BuilderContract){ |
|
43 | + if (!$this->driverBuilderInstance instanceof BuilderContract) { |
|
44 | 44 | exception()->runtime($driverBuilder.' is not instance of '.BuilderContract::class); |
45 | 45 | } |
46 | 46 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->credentials = $credentials; |
45 | 45 | |
46 | 46 | //credentials loop for expected property |
47 | - foreach ($this->credentials->get() as $credential){ |
|
47 | + foreach ($this->credentials->get() as $credential) { |
|
48 | 48 | $this->expected[] = $credential; |
49 | 49 | } |
50 | 50 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | { |
59 | 59 | $credentials = []; |
60 | 60 | |
61 | - foreach ($this->inputs as $inputKey=>$inputValue){ |
|
61 | + foreach ($this->inputs as $inputKey=>$inputValue) { |
|
62 | 62 | |
63 | - if(in_array($inputKey,$this->expected)){ |
|
63 | + if (in_array($inputKey, $this->expected)) { |
|
64 | 64 | $credentials[$inputKey] = $inputValue; |
65 | 65 | } |
66 | 66 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | class AuthenticateProvider extends ConfigProvider implements AuthenticateContract |
10 | 10 | { |
11 | 11 | //get auth response,auth exception,auth token and auth basic |
12 | - use AuthenticateResponse,AuthenticateException,AuthenticateToken,AuthenticateBasic; |
|
12 | + use AuthenticateResponse, AuthenticateException, AuthenticateToken, AuthenticateBasic; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @var string |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | { |
26 | 26 | // header to determine whether |
27 | 27 | // the token value is present and return a callback. |
28 | - return $this->checkTokenViaHeaders(function($token){ |
|
28 | + return $this->checkTokenViaHeaders(function($token) { |
|
29 | 29 | |
30 | 30 | // we send the user-supplied token value |
31 | 31 | // to the authCheckManager object. |
32 | - new AuthCheckManager($this,$token); |
|
32 | + new AuthCheckManager($this, $token); |
|
33 | 33 | |
34 | 34 | // as a result we send output according to |
35 | 35 | // the boolean value from the checkResult method. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function guard($guard) |
48 | 48 | { |
49 | - $this->guard=$guard; |
|
49 | + $this->guard = $guard; |
|
50 | 50 | |
51 | 51 | $this->setAuthenticateNeeds(); |
52 | 52 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | // we obtain the id value obtained via |
64 | 64 | // authenticate availability with the help of callback object. |
65 | - return $this->checkParamsViaAvailability('authId',function($id){ |
|
65 | + return $this->checkParamsViaAvailability('authId', function($id) { |
|
66 | 66 | return $id; |
67 | 67 | }); |
68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param bool $objectReturn |
75 | 75 | * @return $this|mixed |
76 | 76 | */ |
77 | - public function login($credentials=null,$objectReturn=false) |
|
77 | + public function login($credentials = null, $objectReturn = false) |
|
78 | 78 | { |
79 | 79 | // we will determine whether |
80 | 80 | // the http path is correct for this method. |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | |
83 | 83 | // we invoke the login manager and the properties |
84 | 84 | // that this class creates will inform us about user input. |
85 | - $loginManager = new AuthLoginManager($credentials,$this); |
|
85 | + $loginManager = new AuthLoginManager($credentials, $this); |
|
86 | 86 | |
87 | 87 | // if you want to see the entire login manager object directly, |
88 | 88 | // send true to the objectReturn parameter. |
89 | - if($objectReturn) return $loginManager; |
|
89 | + if ($objectReturn) return $loginManager; |
|
90 | 90 | |
91 | 91 | // the login value stored in the params property of the login manager object will return a builder object. |
92 | 92 | // we will return the value of the login state as a boolean using the count method of this builder object. |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | |
107 | 107 | // header to determine whether |
108 | 108 | // the token value is present and return a callback. |
109 | - return $this->checkTokenViaHeaders(function($token){ |
|
109 | + return $this->checkTokenViaHeaders(function($token) { |
|
110 | 110 | |
111 | 111 | // we send the user-supplied token value |
112 | 112 | // to the authCheckManager object. |
113 | - new AuthLogoutManager($this,$token); |
|
113 | + new AuthLogoutManager($this, $token); |
|
114 | 114 | |
115 | 115 | // as a result we send output according to |
116 | 116 | // the boolean value from the checkResult method. |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | // we obtain the token value obtained via |
129 | 129 | // authenticate availability with the help of callback object. |
130 | - return $this->checkParamsViaAvailability('authToken',function($token){ |
|
130 | + return $this->checkParamsViaAvailability('authToken', function($token) { |
|
131 | 131 | return $token; |
132 | 132 | }); |
133 | 133 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | // we obtain the user value obtained via |
143 | 143 | // authenticate availability with the help of callback object. |
144 | - return $this->checkParamsViaAvailability('auth',function($user){ |
|
144 | + return $this->checkParamsViaAvailability('auth', function($user) { |
|
145 | 145 | return $user; |
146 | 146 | }); |
147 | 147 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | // we obtain the data value obtained via |
157 | 157 | // authenticate availability with the help of callback object. |
158 | - return $this->checkParamsViaAvailability('data',function($data){ |
|
158 | + return $this->checkParamsViaAvailability('data', function($data) { |
|
159 | 159 | return $data; |
160 | 160 | }); |
161 | 161 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | protected function paramValues(...$params) |
14 | 14 | { |
15 | - [$type,$query] = $params; |
|
15 | + [$type, $query] = $params; |
|
16 | 16 | |
17 | 17 | // with query we bind the returned values to the params property of the auth object. |
18 | 18 | // and so the auth object will make a final return with these values. |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | // if status is true, |
24 | 24 | // we add values for some user benefits to params global access. |
25 | - if($this->auth->params['status']){ |
|
25 | + if ($this->auth->params['status']) { |
|
26 | 26 | |
27 | 27 | $this->auth->params['auth'] = $query->get(); |
28 | 28 | $this->auth->params['data'] = $query->first(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // with query we bind the returned values to the params property of the auth object. |
43 | 43 | // and so the auth object will make a final return with these values. |
44 | - $this->paramValues('check',$query); |
|
44 | + $this->paramValues('check', $query); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | // with query we bind the returned values to the params property of the auth object. |
60 | 60 | // and so the auth object will make a final return with these values. |
61 | - $this->paramValues('login',$query); |
|
61 | + $this->paramValues('login', $query); |
|
62 | 62 | |
63 | 63 | // we assign the credential hash value |
64 | 64 | // to the global of the authenticate object. |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // with query we bind the returned values to the params property of the auth object. |
84 | 84 | // and so the auth object will make a final return with these values. |
85 | - $this->paramValues('logout',$query); |
|
85 | + $this->paramValues('logout', $query); |
|
86 | 86 | |
87 | 87 | //token updating as null |
88 | 88 | $this->updateToken(md5(time())); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * @var array |
11 | 11 | */ |
12 | - protected $query=[]; |
|
12 | + protected $query = []; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * UserBuilderHelper constructor. |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | { |
19 | 19 | //in addition to the default credentials values |
20 | 20 | // on the user side, a closure method is executed and an extra query occurs. |
21 | - $this->query['addToWhere']=$this->auth->getAddToWhere(); |
|
21 | + $this->query['addToWhere'] = $this->auth->getAddToWhere(); |
|
22 | 22 | |
23 | 23 | //we get the model specified for the builder. |
24 | - $this->query['driver']=$this->auth->getDriverNamespace(); |
|
24 | + $this->query['driver'] = $this->auth->getDriverNamespace(); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected function callbackQueryWithoutCredentials($driver) |
32 | 32 | { |
33 | - if($this->isCallableAddToWhere()){ |
|
33 | + if ($this->isCallableAddToWhere()) { |
|
34 | 34 | |
35 | 35 | return $driver::where(function($query) { |
36 | 36 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | protected function checkQuery($token) |
50 | 50 | { |
51 | 51 | //we get the model specified for the builder. |
52 | - $driver=$this->query['driver']; |
|
52 | + $driver = $this->query['driver']; |
|
53 | 53 | |
54 | 54 | //token query for builder |
55 | 55 | return $driver::where(function($query) use($token) { |
56 | 56 | |
57 | 57 | //where query for token |
58 | - $query->where('token',$token); |
|
58 | + $query->where('token', $token); |
|
59 | 59 | |
60 | 60 | // if the addToWhereClosure value is a closure, |
61 | 61 | // then in this case we actually run |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | protected function logoutQuery($token) |
82 | 82 | { |
83 | 83 | //we get the model specified for the builder. |
84 | - $driver=$this->query['driver']; |
|
84 | + $driver = $this->query['driver']; |
|
85 | 85 | |
86 | 86 | //token query for builder |
87 | - $query=$driver::where(function($query) use($token) { |
|
87 | + $query = $driver::where(function($query) use($token) { |
|
88 | 88 | |
89 | 89 | //where query for token |
90 | - $query->where('token',$token); |
|
90 | + $query->where('token', $token); |
|
91 | 91 | |
92 | 92 | // if the addToWhereClosure value is a closure, |
93 | 93 | // then in this case we actually run |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // if the addToWhereClosure value is a closure, |
108 | 108 | // then in this case we actually run |
109 | 109 | // the closure object and add it to the query value. |
110 | - if($this->isCallableAddToWhere()){ |
|
110 | + if ($this->isCallableAddToWhere()) { |
|
111 | 111 | $this->query['addToWhere']($query); |
112 | 112 | } |
113 | 113 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | //we get the model specified for the builder. |
124 | 124 | $driver = $this->query['driver']; |
125 | 125 | |
126 | - if(count($credentials->get())==0){ |
|
126 | + if (count($credentials->get())==0) { |
|
127 | 127 | |
128 | 128 | // if the credential array is empty in the config section, |
129 | 129 | // then you must run the query with a callable value of addToWhere value. |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | |
137 | 137 | // with the callback method (eloquent model) |
138 | 138 | // we write the where clause. |
139 | - foreach ($credentials->get() as $credential=>$credentialValue){ |
|
140 | - $query->where($credential,$credentialValue); |
|
139 | + foreach ($credentials->get() as $credential=>$credentialValue) { |
|
140 | + $query->where($credential, $credentialValue); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // if the addToWhereClosure value is a closure, |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * @return void|mixed |
152 | 152 | */ |
153 | - protected function updateToken($token=null) |
|
153 | + protected function updateToken($token = null) |
|
154 | 154 | { |
155 | 155 | //if query status value is true |
156 | - if($this->auth->params['status']){ |
|
156 | + if ($this->auth->params['status']) { |
|
157 | 157 | |
158 | 158 | // we go to the method that produces |
159 | 159 | // the classical token value and get the token value. |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | // if there is no update, we reset the status value to 0. |
164 | 164 | $update = $this->auth->params['builder']->update(['token'=>$this->auth->params['token']]); |
165 | 165 | |
166 | - if(!$update){ |
|
167 | - $this->auth->params['status']=0; |
|
168 | - $this->auth->params['exception']='update'; |
|
166 | + if (!$update) { |
|
167 | + $this->auth->params['status'] = 0; |
|
168 | + $this->auth->params['exception'] = 'update'; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | } |