Test Failed
Push — master ( a788a1...0c7821 )
by Php Easy Api
04:30
created
src/resta/Authenticate/Driver/Eloquent/UserBuilderHelper.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $userId = $manager->getAuth()->params['userId'];
53 53
 
54
-        return DeviceToken::where('user_id',$userId)->get();
54
+        return DeviceToken::where('user_id', $userId)->get();
55 55
     }
56 56
 
57 57
     /**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
         return DeviceToken::where(function($query) use($token) {
65 65
 
66 66
             //where query for token
67
-            $query->where('token_integer',crc32(md5($token)));
68
-            $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])));
67
+            $query->where('token_integer', crc32(md5($token)));
68
+            $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])));
69 69
         });
70 70
     }
71 71
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
         return DeviceToken::where(function($query) use($token) {
80 80
 
81 81
             //where query for token
82
-            $query->where('token_integer',crc32(md5($token)));
83
-            $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])));
82
+            $query->where('token_integer', crc32(md5($token)));
83
+            $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])));
84 84
 
85 85
         });
86 86
     }
@@ -91,23 +91,23 @@  discard block
 block discarded – undo
91 91
      * @param null|object $query
92 92
      * @return mixed
93 93
      */
94
-    protected function checkPasswordVerify($query=null)
94
+    protected function checkPasswordVerify($query = null)
95 95
     {
96
-        if(is_null($query) && isset($this->credentials['password'])){
97
-            if(!is_null($password = $this->auth->provider('password'))
98
-                && $password($this->credentials['password'])=='verify'){
96
+        if (is_null($query) && isset($this->credentials['password'])) {
97
+            if (!is_null($password = $this->auth->provider('password'))
98
+                && $password($this->credentials['password'])=='verify') {
99 99
 
100 100
                 $this->password = $this->credentials['password'];
101 101
                 $this->passwordVerify = true;
102
-                $this->credentials = Arr::removeKey($this->credentials,['password']);
102
+                $this->credentials = Arr::removeKey($this->credentials, ['password']);
103 103
 
104 104
                 return null;
105 105
             }
106 106
         }
107 107
 
108
-        if(is_object($query) && $query->count()){
108
+        if (is_object($query) && $query->count()) {
109 109
             $password = $query->first()->password;
110
-            if(password_verify($this->password,$password)){
110
+            if (password_verify($this->password, $password)) {
111 111
                 return $query;
112 112
             }
113 113
         }
@@ -137,24 +137,24 @@  discard block
 block discarded – undo
137 137
 
138 138
             // with the callback method (eloquent model)
139 139
             // we write the where clause.
140
-            foreach ($this->credentials as $credential=>$credentialValue){
140
+            foreach ($this->credentials as $credential=>$credentialValue) {
141 141
 
142
-                if(!is_null($provider = $this->auth->provider($credential))){
143
-                    $query->where($credential,$provider($credentialValue));
142
+                if (!is_null($provider = $this->auth->provider($credential))) {
143
+                    $query->where($credential, $provider($credentialValue));
144 144
                 }
145
-                else{
146
-                    $query->where($credential,$credentialValue);
145
+                else {
146
+                    $query->where($credential, $credentialValue);
147 147
                 }
148 148
             }
149 149
 
150 150
             // for the authenticate query,
151 151
             // the user can add additional queries by the service provider.
152
-            if(!is_null($addQuery = $this->auth->provider('addQuery'))){
152
+            if (!is_null($addQuery = $this->auth->provider('addQuery'))) {
153 153
                 $addQuery($query);
154 154
             }
155 155
         });
156 156
 
157
-        if(false === $this->passwordVerify){
157
+        if (false===$this->passwordVerify) {
158 158
             return $query;
159 159
         }
160 160
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
     /**
165 165
      * @return void|mixed
166 166
      */
167
-    protected function updateToken($token=null)
167
+    protected function updateToken($token = null)
168 168
     {
169 169
         //if query status value is true
170
-        if($this->auth->params['status']){
170
+        if ($this->auth->params['status']) {
171 171
 
172 172
             // we go to the method that produces
173 173
             // the classical token value and get the token value.
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
             // if there is no update, we reset the status value to 0.
178 178
             $update = $this->auth->params['builder']->update(['token'=>$this->auth->params['token']]);
179 179
 
180
-            if(!$update){
180
+            if (!$update) {
181 181
                 $this->auth->params['status'] = 0;
182 182
                 $this->auth->params['exception'] = 'update';
183 183
             }
184
-            else{
185
-                if(!is_null($after = $this->auth->provider('after'))){
186
-                    if(false === $after($this->auth->params['builder']->first())){
184
+            else {
185
+                if (!is_null($after = $this->auth->provider('after'))) {
186
+                    if (false===$after($this->auth->params['builder']->first())) {
187 187
                         $this->auth->params['status'] = 0;
188 188
                         $this->auth->params['exception'] = 'update';
189 189
                     }
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
     {
204 204
         $token_integer = crc32(md5($this->auth->params['token']));
205 205
 
206
-        if(!is_null($token_integer)){
206
+        if (!is_null($token_integer)) {
207 207
 
208
-            if(DeviceToken::where('user_id',$this->auth->params['authId'])
209
-                    ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0){
208
+            if (DeviceToken::where('user_id', $this->auth->params['authId'])
209
+                    ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0) {
210 210
 
211 211
                 return DeviceToken::create([
212 212
                     'user_id' => $this->auth->params['authId'],
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
                     'expire' => $this->auth->getExpire(),
218 218
                 ]);
219 219
             }
220
-            else{
220
+            else {
221 221
 
222
-                return DeviceToken::where('user_id',$this->auth->params['authId'])
223
-                    ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))
222
+                return DeviceToken::where('user_id', $this->auth->params['authId'])
223
+                    ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])))
224 224
                     ->update([
225 225
                         'token' => $this->auth->params['token'],
226 226
                         'token_integer' => $token_integer
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
     {
241 241
         $token_integer = crc32(md5($this->auth->getTokenSentByUser()));
242 242
 
243
-        if(!is_null($token_integer)){
243
+        if (!is_null($token_integer)) {
244 244
 
245
-            DeviceToken::where('token_integer',$token_integer)->delete();
245
+            DeviceToken::where('token_integer', $token_integer)->delete();
246 246
 
247
-            return (DeviceToken::where('token_integer',$token_integer)->count()) ? false : true;
247
+            return (DeviceToken::where('token_integer', $token_integer)->count()) ? false : true;
248 248
         }
249 249
 
250 250
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -141,8 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
                 if(!is_null($provider = $this->auth->provider($credential))){
143 143
                     $query->where($credential,$provider($credentialValue));
144
-                }
145
-                else{
144
+                } else{
146 145
                     $query->where($credential,$credentialValue);
147 146
                 }
148 147
             }
@@ -180,8 +179,7 @@  discard block
 block discarded – undo
180 179
             if(!$update){
181 180
                 $this->auth->params['status'] = 0;
182 181
                 $this->auth->params['exception'] = 'update';
183
-            }
184
-            else{
182
+            } else{
185 183
                 if(!is_null($after = $this->auth->provider('after'))){
186 184
                     if(false === $after($this->auth->params['builder']->first())){
187 185
                         $this->auth->params['status'] = 0;
@@ -216,8 +214,7 @@  discard block
 block discarded – undo
216 214
                     'device_agent_integer' => crc32(md5($_SERVER['HTTP_USER_AGENT'])),
217 215
                     'expire' => $this->auth->getExpire(),
218 216
                 ]);
219
-            }
220
-            else{
217
+            } else{
221 218
 
222 219
                 return DeviceToken::where('user_id',$this->auth->params['authId'])
223 220
                     ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateResponse.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         // if the status value is true,
26 26
         // we send output generated from the token value.
27
-        if($this->checkStatus()){
27
+        if ($this->checkStatus()) {
28 28
             $this->setAuthenticateSuccess(true);
29 29
             return true;
30 30
         }
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         // if the status value is true,
42 42
         // we send output generated from the token value.
43
-        if($this->checkStatus()){
43
+        if ($this->checkStatus()) {
44 44
             return true;
45 45
         }
46 46
 
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function getResult()
55 55
     {
56
-        $result= [];
56
+        $result = [];
57 57
 
58 58
         // if the status value is true,
59 59
         // we send output generated from the token value.
60
-        if($this->checkStatus()){
60
+        if ($this->checkStatus()) {
61 61
             $result['message']                  = 'token success';
62 62
             $result['token']                    = $this->params['token'];
63 63
             $result['user']                     = $this->params['data'];
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @param bool $value
81 81
      */
82
-    private function setAuthenticateSuccess($value=true)
82
+    private function setAuthenticateSuccess($value = true)
83 83
     {
84
-        if(app()->has('authenticateSuccess')){
84
+        if (app()->has('authenticateSuccess')) {
85 85
             app()->terminate('authenticateSuccess');
86 86
         }
87 87
 
88
-        app()->register('authenticateSuccess',$value);
88
+        app()->register('authenticateSuccess', $value);
89 89
     }
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Authenticate/Driver/Eloquent/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 class User extends Eloquent
7 7
 {
8
-    protected $hidden = ['id','password','token'];
8
+    protected $hidden = ['id', 'password', 'token'];
9 9
 
10 10
     /**
11 11
      * User constructor.
Please login to merge, or discard this patch.
src/resta/Console/Source/Client/Client.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     /**
33 33
      * @var array
34 34
      */
35
-    public $commandRule=['name','client'];
35
+    public $commandRule = ['name', 'client'];
36 36
 
37 37
     /**
38 38
      * @method create
@@ -56,35 +56,35 @@  discard block
 block discarded – undo
56 56
 
57 57
         $this->argument['managerTraitNamespace'] = Utils::getNamespace($this->directory['clientNameDir'].'/'.$name.'Trait.php');
58 58
 
59
-        if(!file_exists($manager = $this->directory['clientNameDir'].'/'.$name.'Manager.php')){
59
+        if (!file_exists($manager = $this->directory['clientNameDir'].'/'.$name.'Manager.php')) {
60 60
             $this->touch['client/manager'] = $manager;
61 61
             $this->touch['client/managertrait'] = $this->directory['clientNameDir'].'/'.$name.'Trait.php';
62 62
             
63 63
         }
64 64
 
65
-        if(isset($this->argument['trait'])){
65
+        if (isset($this->argument['trait'])) {
66 66
             $this->argument['name'] = $this->argument['trait'];
67 67
             
68
-            if(!file_exists($managerCustomTrait = $this->directory['clientNameDir'].'/'.$this->argument['trait'].'Trait.php')){
68
+            if (!file_exists($managerCustomTrait = $this->directory['clientNameDir'].'/'.$this->argument['trait'].'Trait.php')) {
69 69
                 $this->touch['client/managercustomtrait'] = $managerCustomTrait;
70 70
             }
71 71
 
72 72
             $this->argument['managerTraitNamespace'] = Utils::getNamespace($managerCustomTrait);
73 73
         }
74 74
 
75
-        if(!file_exists($this->directory['clientNameCreate'].'/Client.php')){
75
+        if (!file_exists($this->directory['clientNameCreate'].'/Client.php')) {
76 76
             $this->touch['client/client'] = $this->directory['clientNameCreate'].'/Client.php';
77 77
             $this->touch['client/clientGenerator'] = $this->directory['clientNameCreate'].'/ClientGenerator.php';
78 78
         }
79 79
 
80 80
         $clientSourceNamespace = Utils::getNamespace($this->directory['clientSource'].'/'.$client.'.php');
81 81
 
82
-        if(!file_exists($clientSourceName = $this->directory['clientSource'].'/'.$client.'.php')){
82
+        if (!file_exists($clientSourceName = $this->directory['clientSource'].'/'.$client.'.php')) {
83 83
             $this->touch['client/source'] = $clientSourceName.'';
84 84
         }
85 85
         
86 86
 
87
-        if(!file_exists($this->directory['clientNameCreate'].'/ClientProvider.php')){
87
+        if (!file_exists($this->directory['clientNameCreate'].'/ClientProvider.php')) {
88 88
             $this->touch['client/clientProvider'] = $this->directory['clientNameCreate'].'/ClientProvider.php';
89 89
         }
90 90
 
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 
99 99
         $nameGeneratorNamespace = Utils::getNamespace($managerPath = $this->directory['clientNameDir'].''.DIRECTORY_SEPARATOR.''.$nameManager.'.php');
100 100
 
101
-        $generator = new Generator(path()->version(),'ClientManager');
101
+        $generator = new Generator(path()->version(), 'ClientManager');
102 102
 
103 103
         $clientManager = app()->namespace()->version().'\\ClientManager';
104 104
 
105 105
         $clientManagerResolve = new $clientManager;
106 106
 
107
-        if(!method_exists($clientManagerResolve,strtolower($name))){
107
+        if (!method_exists($clientManagerResolve, strtolower($name))) {
108 108
 
109 109
             $generator->createMethod([
110 110
                 strtolower($name)
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 
136 136
         }
137 137
 
138
-        $nameGenerator = new Generator($this->directory['clientNameDir'],$name.'Manager');
138
+        $nameGenerator = new Generator($this->directory['clientNameDir'], $name.'Manager');
139 139
 
140 140
         $nameGeneratorNamespaceResolve = new $nameGeneratorNamespace;
141 141
 
142
-        if(!method_exists($nameGeneratorNamespaceResolve,strtolower($client))){
142
+        if (!method_exists($nameGeneratorNamespaceResolve, strtolower($client))) {
143 143
 
144 144
             $nameGenerator->createMethod([
145 145
                 strtolower($client)
Please login to merge, or discard this patch.
src/resta/Authenticate/ConfigProvider.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -219,8 +219,7 @@
 block discarded – undo
219 219
             $table = $this->config['guard'][$this->guard]['deviceTokenRegister'];
220 220
 
221 221
             app()->register('authenticateDeviceTokenTable',$table);
222
-        }
223
-        else{
222
+        } else{
224 223
             app()->register('authenticateDeviceTokenTable','device_tokens');
225 224
         }
226 225
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $this->config();
33 33
 
34
-        if($this->guard=="default"){
34
+        if ($this->guard=="default") {
35 35
             $this->setAuthenticateNeeds();
36 36
         }
37 37
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $this->config = config('authenticate');
51 51
 
52
-        if(!is_null($config = $this->provider('configuration'))){
52
+        if (!is_null($config = $this->provider('configuration'))) {
53 53
             $this->config['guard'][$this->guard] = $config($this->config['guard'][$this->guard]);
54 54
         }
55 55
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function getAddToWhere()
65 65
     {
66
-        if(isset($this->config['guard'][$this->guard]['addToWhere'])){
66
+        if (isset($this->config['guard'][$this->guard]['addToWhere'])) {
67 67
             return $this->config['guard'][$this->guard]['addToWhere'];
68 68
         }
69 69
         return null;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getConfigToken()
78 78
     {
79
-        if(isset($this->config['guard'][$this->guard]['token'])){
79
+        if (isset($this->config['guard'][$this->guard]['token'])) {
80 80
             return $this->config['guard'][$this->guard]['token'];
81 81
         }
82 82
         return null;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function provider($key)
172 172
     {
173
-        if(app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))){
173
+        if (app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))) {
174 174
             return $provider;
175 175
         }
176 176
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $table = $this->config['guard'][$this->guard]['table'];
211 211
 
212
-        app()->register('authenticateTable',$table);
212
+        app()->register('authenticateTable', $table);
213 213
     }
214 214
 
215 215
     /**
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function deviceTokenTable()
221 221
     {
222
-        if(isset($this->config['guard'][$this->guard]['deviceTokenRegister'])){
222
+        if (isset($this->config['guard'][$this->guard]['deviceTokenRegister'])) {
223 223
             $table = $this->config['guard'][$this->guard]['deviceTokenRegister'];
224 224
 
225
-            app()->register('authenticateDeviceTokenTable',$table);
225
+            app()->register('authenticateDeviceTokenTable', $table);
226 226
         }
227
-        else{
228
-            app()->register('authenticateDeviceTokenTable','device_tokens');
227
+        else {
228
+            app()->register('authenticateDeviceTokenTable', 'device_tokens');
229 229
         }
230 230
 
231 231
     }
Please login to merge, or discard this patch.
src/resta/Authenticate/Driver/Eloquent/DeviceToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
     /**
9 9
      * @var array
10 10
      */
11
-    protected $fillable = ['user_id','token','token_integer','device_agent','device_agent_integer','expire'];
11
+    protected $fillable = ['user_id', 'token', 'token_integer', 'device_agent', 'device_agent_integer', 'expire'];
12 12
 
13 13
     /**
14 14
      * User constructor.
Please login to merge, or discard this patch.
src/resta/Middleware/ExcludeMiddleware.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param callable $callback
30 30
      * @return mixed
31 31
      */
32
-    public function exclude($middleware,callable $callback)
32
+    public function exclude($middleware, callable $callback)
33 33
     {
34 34
         $this->result = true;
35 35
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         //if there is exclude method
43 43
         //in service middleware class
44
-        if($this->existMethod()){
44
+        if ($this->existMethod()) {
45 45
 
46 46
             //call exclude method
47 47
             /**
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
             $serviceMiddleware = $middleware['class'];
51 51
             $excludes = $serviceMiddleware->exclude();
52 52
 
53
-            foreach ($excludes as $excludeKey=>$excludeVal){
54
-                $this->excludeProcess($excludeKey,$excludeVal);
53
+            foreach ($excludes as $excludeKey=>$excludeVal) {
54
+                $this->excludeProcess($excludeKey, $excludeVal);
55 55
             }
56 56
         }
57 57
 
58 58
         //return true
59
-        return Utils::returnCallback($this->result,$callback);
59
+        return Utils::returnCallback($this->result, $callback);
60 60
     }
61 61
 
62 62
     /**
63 63
      * @param $excludeKey
64 64
      * @param $excludeVal
65 65
      */
66
-    private function excludeProcess($excludeKey,$excludeVal)
66
+    private function excludeProcess($excludeKey, $excludeVal)
67 67
     {
68
-        $this->excludeForAll($excludeKey,$excludeVal,function() use ($excludeKey,$excludeVal){
68
+        $this->excludeForAll($excludeKey, $excludeVal, function() use ($excludeKey, $excludeVal){
69 69
 
70
-            if($excludeKey == $this->excludeList['middleware']['middlewareName']){
70
+            if ($excludeKey==$this->excludeList['middleware']['middlewareName']) {
71 71
                 $this->result = true;
72 72
                 $this->inArrayExclude($excludeVal);
73 73
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function existMethod()
82 82
     {
83
-        return Utils::existMethod($this->excludeList['middleware']['class'],'exclude');
83
+        return Utils::existMethod($this->excludeList['middleware']['class'], 'exclude');
84 84
     }
85 85
 
86 86
     /**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function inArrayExclude($exclude)
90 90
     {
91
-        foreach($exclude as $item){
92
-            if(in_array($item,$this->middleware['odds'])){
91
+        foreach ($exclude as $item) {
92
+            if (in_array($item, $this->middleware['odds'])) {
93 93
                 $this->result = false;
94 94
             }
95 95
         }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param callable $callback
102 102
      * @return mixed
103 103
      */
104
-    private function excludeForAll($excludeKey,$excludeVal,callable $callback)
104
+    private function excludeForAll($excludeKey, $excludeVal, callable $callback)
105 105
     {
106 106
         return ($excludeKey=="all") ? $this->inArrayExclude($excludeVal) : call_user_func($callback);
107 107
     }
Please login to merge, or discard this patch.