Test Setup Failed
Push — master ( f0f097...c6f3d6 )
by Php Easy Api
04:31
created
src/resta/Authenticate/Driver/Eloquent/UserBuilderHelper.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $userId = $manager->getAuth()->params['userId'];
37 37
 
38
-        return DeviceToken::where('user_id',$userId)->get();
38
+        return DeviceToken::where('user_id', $userId)->get();
39 39
     }
40 40
 
41 41
     /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     protected function callbackQueryWithoutCredentials($driver)
46 46
     {
47
-        if($this->isCallableAddToWhere()){
47
+        if ($this->isCallableAddToWhere()) {
48 48
 
49 49
             return $driver::where(function($query) {
50 50
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
         return DeviceToken::where(function($query) use($token) {
67 67
 
68 68
             //where query for token
69
-            $query->where('token_integer',crc32(md5($token)));
70
-            $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])));
69
+            $query->where('token_integer', crc32(md5($token)));
70
+            $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])));
71 71
 
72 72
             // if the addToWhereClosure value is a closure,
73 73
             // then in this case we actually run
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
         return DeviceToken::where(function($query) use($token) {
97 97
 
98 98
             //where query for token
99
-            $query->where('token_integer',crc32(md5($token)));
100
-            $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])));
99
+            $query->where('token_integer', crc32(md5($token)));
100
+            $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])));
101 101
 
102 102
             // if the addToWhereClosure value is a closure,
103 103
             // then in this case we actually run
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
      * @param array $credentials
115 115
      * @return mixed
116 116
      */
117
-    protected function queryAddToWhere($query,$credentials=array())
117
+    protected function queryAddToWhere($query, $credentials = array())
118 118
     {
119 119
         // if the addToWhereClosure value is a closure,
120 120
         // then in this case we actually run
121 121
         // the closure object and add it to the query value.
122
-        if($this->isCallableAddToWhere()){
123
-            return $this->query['addToWhere']($query,$credentials);
122
+        if ($this->isCallableAddToWhere()) {
123
+            return $this->query['addToWhere']($query, $credentials);
124 124
         }
125 125
     }
126 126
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         //we get the model specified for the builder.
136 136
         $driver = $this->query['driver'];
137 137
 
138
-        if(count($credentials->get())==0){
138
+        if (count($credentials->get())==0) {
139 139
 
140 140
             // if the credential array is empty in the config section,
141 141
             // then you must run the query with a callable value of addToWhere value.
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
         }
144 144
 
145 145
         //
146
-        if($this->isCallableAddToWhere()){
147
-            return $this->queryAddToWhere($driver,$credentials->get());
146
+        if ($this->isCallableAddToWhere()) {
147
+            return $this->queryAddToWhere($driver, $credentials->get());
148 148
         }
149 149
 
150 150
         // using the driver object we write the query builder statement.
@@ -153,24 +153,24 @@  discard block
 block discarded – undo
153 153
 
154 154
             // with the callback method (eloquent model)
155 155
             // we write the where clause.
156
-            foreach ($credentials->get() as $credential=>$credentialValue){
157
-                $query->where($credential,$credentialValue);
156
+            foreach ($credentials->get() as $credential=>$credentialValue) {
157
+                $query->where($credential, $credentialValue);
158 158
             }
159 159
 
160 160
             // if the addToWhereClosure value is a closure,
161 161
             // then in this case we actually run
162 162
             // the closure object and add it to the query value.
163
-            $this->queryAddToWhere($query,$credentials->get(),$credentials->get());
163
+            $this->queryAddToWhere($query, $credentials->get(), $credentials->get());
164 164
         });
165 165
     }
166 166
 
167 167
     /**
168 168
      * @return void|mixed
169 169
      */
170
-    protected function updateToken($token=null)
170
+    protected function updateToken($token = null)
171 171
     {
172 172
         //if query status value is true
173
-        if($this->auth->params['status']){
173
+        if ($this->auth->params['status']) {
174 174
 
175 175
             // we go to the method that produces
176 176
             // the classical token value and get the token value.
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             // if there is no update, we reset the status value to 0.
181 181
             $update = $this->auth->params['builder']->update(['token'=>$this->auth->params['token']]);
182 182
 
183
-            if(!$update){
183
+            if (!$update) {
184 184
                 $this->auth->params['status'] = 0;
185 185
                 $this->auth->params['exception'] = 'update';
186 186
             }
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
     {
197 197
         $token_integer = crc32(md5($this->auth->params['token']));
198 198
 
199
-        if(!is_null($token_integer)){
199
+        if (!is_null($token_integer)) {
200 200
 
201
-            if(DeviceToken::where('user_id',$this->auth->params['authId'])
202
-                ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0){
201
+            if (DeviceToken::where('user_id', $this->auth->params['authId'])
202
+                ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0) {
203 203
 
204 204
                 return DeviceToken::create([
205 205
                     'user_id' => $this->auth->params['authId'],
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
                     'expire' => $this->auth->getExpire(),
211 211
                 ]);
212 212
             }
213
-            else{
213
+            else {
214 214
 
215
-                return DeviceToken::where('user_id',$this->auth->params['authId'])
216
-                    ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))
215
+                return DeviceToken::where('user_id', $this->auth->params['authId'])
216
+                    ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])))
217 217
                     ->update([
218 218
                     'token' => $this->auth->params['token'],
219 219
                     'token_integer' => $token_integer
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
     {
234 234
         $token_integer = crc32(md5($this->auth->getTokenSentByUser()));
235 235
 
236
-        if(!is_null($token_integer)){
236
+        if (!is_null($token_integer)) {
237 237
 
238
-            DeviceToken::where('token_integer',$token_integer)->delete();
238
+            DeviceToken::where('token_integer', $token_integer)->delete();
239 239
             
240
-            return (DeviceToken::where('token_integer',$token_integer)->count()) ? false : true;
240
+            return (DeviceToken::where('token_integer', $token_integer)->count()) ? false : true;
241 241
         }
242 242
 
243 243
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -209,8 +209,7 @@
 block discarded – undo
209 209
                     'device_agent_integer' => crc32(md5($_SERVER['HTTP_USER_AGENT'])),
210 210
                     'expire' => $this->auth->getExpire(),
211 211
                 ]);
212
-            }
213
-            else{
212
+            } else{
214 213
 
215 214
                 return DeviceToken::where('user_id',$this->auth->params['authId'])
216 215
                     ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))
Please login to merge, or discard this patch.
src/resta/Authenticate/Driver/Eloquent/UserBuilder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
         // with query we bind the returned values to the params property of the auth object.
54 54
         // and so the auth object will make a final return with these values.
55
-        $this->paramValues('check',$query);
55
+        $this->paramValues('check', $query);
56 56
     }
57 57
 
58 58
     /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         // with query we bind the returned values to the params property of the auth object.
71 71
         // and so the auth object will make a final return with these values.
72
-        $this->paramValues('login',$query);
72
+        $this->paramValues('login', $query);
73 73
 
74 74
         // we assign the credential hash value
75 75
         // to the global of the authenticate object.
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         // we update the token value.
80 80
         $this->updateToken();
81 81
         
82
-        if(isset($this->auth->params['authToken'])){
82
+        if (isset($this->auth->params['authToken'])) {
83 83
             $this->saveDeviceToken();
84 84
         }
85 85
     }
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 
98 98
         // with query we bind the returned values to the params property of the auth object.
99 99
         // and so the auth object will make a final return with these values.
100
-        $this->paramValues('logout',$query);
100
+        $this->paramValues('logout', $query);
101 101
 
102 102
         //token updating as null
103
-        if(isset($this->auth->params['authToken'])){
104
-            if(!$this->deleteDeviceToken()){
103
+        if (isset($this->auth->params['authToken'])) {
104
+            if (!$this->deleteDeviceToken()) {
105 105
                 $this->auth->params['status'] = 0;
106 106
                 $this->auth->params['exception'] = 'logoutInternal';
107 107
                 return false;
108 108
             }
109 109
         }
110 110
 
111
-        if($this->auth->params['status']===0){
111
+        if ($this->auth->params['status']===0) {
112 112
             $this->auth->params['exception'] = 'logoutException';
113 113
         }
114 114
     }
Please login to merge, or discard this patch.
src/resta/Authenticate/Resource/AuthUserManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      * @param $deviceTokenId
12 12
      * @param AuthenticateProvider $auth
13 13
      */
14
-    public function __construct($deviceTokenId,$auth)
14
+    public function __construct($deviceTokenId, $auth)
15 15
     {
16 16
         parent::__construct($auth);
17 17
         
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateBasic.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
      * @param callable|null $callback
10 10
      * @return mixed|null
11 11
      */
12
-    protected function checkParamsViaAvailability($data,callable $callback=null)
12
+    protected function checkParamsViaAvailability($data, callable $callback = null)
13 13
     {
14
-        if(is_callable($data) && is_null($callback)){
14
+        if (is_callable($data) && is_null($callback)) {
15 15
             
16 16
             // if an authenticate is provided via the existing check method,
17 17
             // then we return the value of the data that we are checking for with callback help.
18
-            if($this->check()){
18
+            if ($this->check()) {
19 19
                 return call_user_func($data);
20 20
             } 
21 21
         }
22 22
         
23 23
         // if an authenticate is provided via the existing check method,
24 24
         // then we return the value of the data that we are checking for with callback help.
25
-        if($this->check() && isset($this->params[$data])){
26
-            return call_user_func_array($callback,[$this->params[$data]]);
25
+        if ($this->check() && isset($this->params[$data])) {
26
+            return call_user_func_array($callback, [$this->params[$data]]);
27 27
         }
28 28
 
29 29
         return null;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
         // we will determine whether
40 40
         // the http path is correct for this method.
41
-        if(isset($getHttp[$type]) and $getHttp[$type]!==httpMethod()){
41
+        if (isset($getHttp[$type]) and $getHttp[$type]!==httpMethod()) {
42 42
             $this->getExceptionForHttp($getHttp[$type]);
43 43
         }
44 44
     }
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
     {
51 51
         // if there is a token in the headers,
52 52
         // we return the callback.
53
-        if(!is_null($this->getTokenSentByUser())){
54
-            return call_user_func_array($callback,[$this->getTokenSentByUser()]);
53
+        if (!is_null($this->getTokenSentByUser())) {
54
+            return call_user_func_array($callback, [$this->getTokenSentByUser()]);
55 55
         }
56 56
 
57 57
         //token false
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateResponse.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         }
45 45
 
46 46
         //logout exception
47
-       $this->{$this->params['exception']}();
47
+        $this->{$this->params['exception']}();
48 48
     }
49 49
 
50 50
     /**
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateProvider.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 class AuthenticateProvider extends ConfigProvider implements AuthenticateContract
11 11
 {
12 12
     //get auth response,auth exception,auth token and auth basic
13
-    use AuthenticateResponse,AuthenticateException,AuthenticateToken,AuthenticateBasic;
13
+    use AuthenticateResponse, AuthenticateException, AuthenticateToken, AuthenticateBasic;
14 14
 
15 15
     /**
16 16
      * @var string
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
     {
27 27
         // we obtain the data value obtained via
28 28
         // authenticate availability with the help of callback object.
29
-        return $this->checkParamsViaAvailability(function(){
30
-            return (new AuthUserManager($this->currentDeviceToken(),$this))->allDeviceTokens();
29
+        return $this->checkParamsViaAvailability(function() {
30
+            return (new AuthUserManager($this->currentDeviceToken(), $this))->allDeviceTokens();
31 31
         });
32 32
     }
33 33
 
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
     {
41 41
         // header to determine whether
42 42
         // the token value is present and return a callback.
43
-        return $this->checkTokenViaHeaders(function($token){
43
+        return $this->checkTokenViaHeaders(function($token) {
44 44
 
45 45
             // we send the user-supplied token value
46 46
             // to the authCheckManager object.
47
-            new AuthCheckManager($this,$token);
47
+            new AuthCheckManager($this, $token);
48 48
 
49 49
             // as a result we send output according to
50 50
             // the boolean value from the checkResult method.
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         // we obtain the data value obtained via
63 63
         // authenticate availability with the help of callback object.
64
-        return $this->checkParamsViaAvailability('data',function($data){
64
+        return $this->checkParamsViaAvailability('data', function($data) {
65 65
             return $data;
66 66
         });
67 67
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function guard($guard)
77 77
     {
78
-        $this->guard=$guard;
78
+        $this->guard = $guard;
79 79
 
80 80
         $this->setAuthenticateNeeds();
81 81
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param bool $objectReturn
90 90
      * @return $this|mixed
91 91
      */
92
-    public function login($credentials=null,$objectReturn=false)
92
+    public function login($credentials = null, $objectReturn = false)
93 93
     {
94 94
         // we will determine whether
95 95
         // the http path is correct for this method.
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 
98 98
         // we invoke the login manager and the properties
99 99
         // that this class creates will inform us about user input.
100
-        $loginManager = new AuthLoginManager($credentials,$this);
100
+        $loginManager = new AuthLoginManager($credentials, $this);
101 101
 
102 102
         // if you want to see the entire login manager object directly,
103 103
         // send true to the objectReturn parameter.
104
-        if($objectReturn) return $loginManager;
104
+        if ($objectReturn) return $loginManager;
105 105
 
106 106
         // the login value stored in the params property of the login manager object will return a builder object.
107 107
         // we will return the value of the login state as a boolean using the count method of this builder object.
108
-        if($this->getModel()=="Default"){
108
+        if ($this->getModel()=="Default") {
109 109
             return $this->getResult();
110 110
         }
111 111
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
         // header to determine whether
128 128
         // the token value is present and return a callback.
129
-        return $this->checkTokenViaHeaders(function($token){
129
+        return $this->checkTokenViaHeaders(function($token) {
130 130
 
131 131
             // we send the user-supplied token value
132 132
             // to the authCheckManager object.
133
-            new AuthLogoutManager($this,$token);
133
+            new AuthLogoutManager($this, $token);
134 134
 
135 135
             // as a result we send output according to
136 136
             // the boolean value from the checkResult method.
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
     {
148 148
         // we obtain the user value obtained via
149 149
         // authenticate availability with the help of callback object.
150
-        return $this->checkParamsViaAvailability(function(){
151
-            return (new AuthUserManager($this->currentDeviceToken(),$this))->userProcess();
150
+        return $this->checkParamsViaAvailability(function() {
151
+            return (new AuthUserManager($this->currentDeviceToken(), $this))->userProcess();
152 152
         });
153 153
     }
154 154
 
Please login to merge, or discard this patch.