@@ -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 | $this->getModel(); |
102 | 102 | |
103 | - if($this->model=="Default"){ |
|
103 | + if ($this->model=="Default") { |
|
104 | 104 | |
105 | 105 | return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\UserBuilder'; |
106 | 106 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $this->getModel(); |
129 | 129 | |
130 | - if($this->model=="Default"){ |
|
130 | + if ($this->model=="Default") { |
|
131 | 131 | |
132 | 132 | return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\User'; |
133 | 133 | } |
@@ -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,15 +82,15 @@ 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. |
93 | - if($this->getModel()=="Default"){ |
|
93 | + if ($this->getModel()=="Default") { |
|
94 | 94 | return $this->getResult(); |
95 | 95 | } |
96 | 96 | |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | |
112 | 112 | // header to determine whether |
113 | 113 | // the token value is present and return a callback. |
114 | - return $this->checkTokenViaHeaders(function($token){ |
|
114 | + return $this->checkTokenViaHeaders(function($token) { |
|
115 | 115 | |
116 | 116 | // we send the user-supplied token value |
117 | 117 | // to the authCheckManager object. |
118 | - new AuthLogoutManager($this,$token); |
|
118 | + new AuthLogoutManager($this, $token); |
|
119 | 119 | |
120 | 120 | // as a result we send output according to |
121 | 121 | // the boolean value from the checkResult method. |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | // we obtain the token value obtained via |
134 | 134 | // authenticate availability with the help of callback object. |
135 | - return $this->checkParamsViaAvailability('authToken',function($token){ |
|
135 | + return $this->checkParamsViaAvailability('authToken', function($token) { |
|
136 | 136 | return $token; |
137 | 137 | }); |
138 | 138 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | // we obtain the user value obtained via |
148 | 148 | // authenticate availability with the help of callback object. |
149 | - return $this->checkParamsViaAvailability('auth',function($user){ |
|
149 | + return $this->checkParamsViaAvailability('auth', function($user) { |
|
150 | 150 | return $user; |
151 | 151 | }); |
152 | 152 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | { |
161 | 161 | // we obtain the data value obtained via |
162 | 162 | // authenticate availability with the help of callback object. |
163 | - return $this->checkParamsViaAvailability('data',function($data){ |
|
163 | + return $this->checkParamsViaAvailability('data', function($data) { |
|
164 | 164 | return $data; |
165 | 165 | }); |
166 | 166 | } |
@@ -19,16 +19,16 @@ 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 | - if($this->auth->getModel()=="Default"){ |
|
31 | + if ($this->auth->getModel()=="Default") { |
|
32 | 32 | $this->loginProcess(); |
33 | 33 | } |
34 | 34 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // if the user is not going to use the config setting, |
44 | 44 | // then in this case it can attempt to login by sending parameters |
45 | 45 | // as an array to the login method. |
46 | - if(is_array($credentials) && count($credentials)){ |
|
46 | + if (is_array($credentials) && count($credentials)) { |
|
47 | 47 | |
48 | 48 | $this->using = true; |
49 | 49 | return $credentials; |
@@ -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 |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | * @param $query |
106 | 106 | * @param null|array$credentials |
107 | 107 | */ |
108 | - protected function queryAddToWhere($query,$credentials) |
|
108 | + protected function queryAddToWhere($query, $credentials) |
|
109 | 109 | { |
110 | 110 | // if the addToWhereClosure value is a closure, |
111 | 111 | // then in this case we actually run |
112 | 112 | // the closure object and add it to the query value. |
113 | - if($this->isCallableAddToWhere()){ |
|
114 | - return $this->query['addToWhere']($query,$credentials); |
|
113 | + if ($this->isCallableAddToWhere()) { |
|
114 | + return $this->query['addToWhere']($query, $credentials); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | //we get the model specified for the builder. |
127 | 127 | $driver = $this->query['driver']; |
128 | 128 | |
129 | - if(count($credentials->get())==0){ |
|
129 | + if (count($credentials->get())==0) { |
|
130 | 130 | |
131 | 131 | // if the credential array is empty in the config section, |
132 | 132 | // then you must run the query with a callable value of addToWhere value. |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | // |
137 | - if($this->isCallableAddToWhere()){ |
|
138 | - return $this->queryAddToWhere($driver,$credentials->get()); |
|
137 | + if ($this->isCallableAddToWhere()) { |
|
138 | + return $this->queryAddToWhere($driver, $credentials->get()); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | // using the driver object we write the query builder statement. |
@@ -144,24 +144,24 @@ discard block |
||
144 | 144 | |
145 | 145 | // with the callback method (eloquent model) |
146 | 146 | // we write the where clause. |
147 | - foreach ($credentials->get() as $credential=>$credentialValue){ |
|
148 | - $query->where($credential,$credentialValue); |
|
147 | + foreach ($credentials->get() as $credential=>$credentialValue) { |
|
148 | + $query->where($credential, $credentialValue); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // if the addToWhereClosure value is a closure, |
152 | 152 | // then in this case we actually run |
153 | 153 | // the closure object and add it to the query value. |
154 | - $this->queryAddToWhere($query,$credentials->get()); |
|
154 | + $this->queryAddToWhere($query, $credentials->get()); |
|
155 | 155 | }); |
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | 159 | * @return void|mixed |
160 | 160 | */ |
161 | - protected function updateToken($token=null) |
|
161 | + protected function updateToken($token = null) |
|
162 | 162 | { |
163 | 163 | //if query status value is true |
164 | - if($this->auth->params['status']){ |
|
164 | + if ($this->auth->params['status']) { |
|
165 | 165 | |
166 | 166 | // we go to the method that produces |
167 | 167 | // the classical token value and get the token value. |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | // if there is no update, we reset the status value to 0. |
172 | 172 | $update = $this->auth->params['builder']->update(['token'=>$this->auth->params['token']]); |
173 | 173 | |
174 | - if(!$update){ |
|
175 | - $this->auth->params['status']=0; |
|
176 | - $this->auth->params['exception']='update'; |
|
174 | + if (!$update) { |
|
175 | + $this->auth->params['status'] = 0; |
|
176 | + $this->auth->params['exception'] = 'update'; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | } |
@@ -44,7 +44,7 @@ |
||
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 |