Test Setup Failed
Push — master ( e36cb8...a6c33a )
by Php Easy Api
03:54
created
src/resta/Authenticate/Resource/AuthCheckManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/resta/Authenticate/Resource/AuthLogoutManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateToken.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/resta/Authenticate/Driver/Eloquent/UserBuilder.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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()));
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
@@ -8,5 +8,5 @@
 block discarded – undo
8 8
     /**
9 9
      * @var $table string
10 10
      */
11
-    protected $table='users';
11
+    protected $table = 'users';
12 12
 }
Please login to merge, or discard this patch.
src/resta/Authenticate/Driver/Eloquent/UserBuilderHelper.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     /**
8 8
      * @var array
9 9
      */
10
-    protected $query=[];
10
+    protected $query = [];
11 11
 
12 12
     /**
13 13
      * UserBuilderHelper constructor.
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
     {
17 17
         //in addition to the default credentials values
18 18
         // ​​on the user side, a closure method is executed and an extra query occurs.
19
-        $this->query['addToWhere']=$this->auth->getAddToWhere();
19
+        $this->query['addToWhere'] = $this->auth->getAddToWhere();
20 20
 
21 21
         //we get the model specified for the builder.
22
-        $this->query['driver']=$this->auth->getDriverNamespace();
22
+        $this->query['driver'] = $this->auth->getDriverNamespace();
23 23
     }
24 24
 
25 25
     /**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     protected function callbackQueryWithoutCredentials($driver)
30 30
     {
31
-        if($this->isCallableAddToWhere()){
31
+        if ($this->isCallableAddToWhere()) {
32 32
 
33 33
             return $driver::where(function($query) {
34 34
 
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
     protected function checkQuery($token)
48 48
     {
49 49
         //we get the model specified for the builder.
50
-        $driver=$this->query['driver'];
50
+        $driver = $this->query['driver'];
51 51
 
52 52
         //token query for builder
53 53
         return $driver::where(function($query) use($token) {
54 54
 
55 55
             //where query for token
56
-            $query->where('token',$token);
56
+            $query->where('token', $token);
57 57
 
58 58
             // if the addToWhereClosure value is a closure,
59 59
             // then in this case we actually run
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
     protected function logoutQuery($token)
80 80
     {
81 81
         //we get the model specified for the builder.
82
-        $driver=$this->query['driver'];
82
+        $driver = $this->query['driver'];
83 83
 
84 84
         //token query for builder
85
-        $query=$driver::where(function($query) use($token) {
85
+        $query = $driver::where(function($query) use($token) {
86 86
 
87 87
             //where query for token
88
-            $query->where('token',$token);
88
+            $query->where('token', $token);
89 89
 
90 90
             // if the addToWhereClosure value is a closure,
91 91
             // then in this case we actually run
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         // if the addToWhereClosure value is a closure,
106 106
         // then in this case we actually run
107 107
         // the closure object and add it to the query value.
108
-        if($this->isCallableAddToWhere()){
108
+        if ($this->isCallableAddToWhere()) {
109 109
             $this->query['addToWhere']($query);
110 110
         }
111 111
     }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     protected function setQuery($credentials)
118 118
     {
119 119
         //we get the model specified for the builder.
120
-        $driver=$this->query['driver'];
120
+        $driver = $this->query['driver'];
121 121
 
122
-        if(count($credentials->get())==0){
122
+        if (count($credentials->get())==0) {
123 123
 
124 124
             // if the credential array is empty in the config section,
125 125
             // then you must run the query with a callable value of addToWhere value.
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 
133 133
             // with the callback method (eloquent model)
134 134
             // we write the where clause.
135
-            foreach ($credentials->get() as $credential=>$credentialValue){
136
-                $query->where($credential,$credentialValue);
135
+            foreach ($credentials->get() as $credential=>$credentialValue) {
136
+                $query->where($credential, $credentialValue);
137 137
             }
138 138
 
139 139
             // if the addToWhereClosure value is a closure,
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
     /**
147 147
      * @return void|mixed
148 148
      */
149
-    protected function updateToken($token=null)
149
+    protected function updateToken($token = null)
150 150
     {
151 151
         //if query status value is true
152
-        if($this->auth->params['status']){
152
+        if ($this->auth->params['status']) {
153 153
 
154 154
             // we go to the method that produces
155 155
             // the classical token value and get the token value.
156
-            $this->auth->params['token']=($token===null) ? $this->auth->getTokenData() : $token;
156
+            $this->auth->params['token'] = ($token===null) ? $this->auth->getTokenData() : $token;
157 157
 
158 158
             // we update the token value.
159 159
             // if there is no update, we reset the status value to 0.
160
-            $update=$this->auth->params['builder']->update(['token'=>$this->auth->params['token']]);
160
+            $update = $this->auth->params['builder']->update(['token'=>$this->auth->params['token']]);
161 161
 
162
-            if(!$update){
163
-                $this->auth->params['status']=0;
164
-                $this->auth->params['exception']='update';
162
+            if (!$update) {
163
+                $this->auth->params['status'] = 0;
164
+                $this->auth->params['exception'] = 'update';
165 165
             }
166 166
         }
167 167
     }
Please login to merge, or discard this patch.
src/resta/Authenticate/Driver/BuilderParamGenerator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
      */
11 11
     protected function paramValues(...$params)
12 12
     {
13
-        list($type,$query)=$params;
13
+        list($type, $query) = $params;
14 14
 
15 15
         // with query we bind the returned values to the params property of the auth object.
16 16
         // and so the auth object will make a final return with these values.
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
         // if status is true,
22 22
         // we add values ​​for some user benefits to params global access.
23
-        if($this->auth->params['status']){
23
+        if ($this->auth->params['status']) {
24 24
 
25 25
             $this->auth->params['auth']        = $query->get();
26 26
             $this->auth->params['data']        = $query->first();
Please login to merge, or discard this patch.
src/resta/Authenticate/AuthenticateResponse.php 2 patches
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->logoutException();
47
+        $this->logoutException();
48 48
     }
49 49
 
50 50
     /**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     /**
8 8
      * @var array $params
9 9
      */
10
-    public $params=[];
10
+    public $params = [];
11 11
 
12 12
     /**
13 13
      * @return bool
@@ -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
             return true;
29 29
         }
30 30
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     {
40 40
         // if the status value is true,
41 41
         // we send output generated from the token value.
42
-        if($this->checkStatus()){
42
+        if ($this->checkStatus()) {
43 43
             return true;
44 44
         }
45 45
 
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function getResult()
54 54
     {
55
-        $result= [];
55
+        $result = [];
56 56
 
57 57
         // if the status value is true,
58 58
         // we send output generated from the token value.
59
-        if($this->checkStatus()){
59
+        if ($this->checkStatus()) {
60 60
             $result['message']                  = 'token success';
61 61
             $result['token']                    = $this->params['token'];
62 62
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         }
66 66
 
67 67
         //in the params property, we set the exception type according to the exception value.
68
-        $exceptionType=(isset($this->params['exception'])) ? $this->params['exception'] : 'credentials';
68
+        $exceptionType = (isset($this->params['exception'])) ? $this->params['exception'] : 'credentials';
69 69
 
70 70
         // if the status is unsuccessful,
71 71
         // the direct exception will be thrown away.
Please login to merge, or discard this patch.
src/resta/Authenticate/ConfigProvider.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
     /**
10 10
      * @var string
11 11
      */
12
-    protected $driverDefaultNamespace="\Resta\Authenticate\Driver";
12
+    protected $driverDefaultNamespace = "\Resta\Authenticate\Driver";
13 13
 
14 14
     /**
15 15
      * @var string $store
16 16
      */
17
-    protected $store='session';
17
+    protected $store = 'session';
18 18
 
19 19
     /**
20 20
      * @var $config
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
     }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function config()
50 50
     {
51
-        $this->config=config('authenticate');
51
+        $this->config = config('authenticate');
52 52
 
53 53
         return $this->config;
54 54
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function getAddToWhere()
60 60
     {
61
-        if(isset($this->config['guard'][$this->guard]['addToWhere'])){
61
+        if (isset($this->config['guard'][$this->guard]['addToWhere'])) {
62 62
             return $this->config['guard'][$this->guard]['addToWhere'];
63 63
         }
64 64
         return null;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function getConfigToken()
71 71
     {
72
-        if(isset($this->config['guard'][$this->guard]['token'])){
72
+        if (isset($this->config['guard'][$this->guard]['token'])) {
73 73
             return $this->config['guard'][$this->guard]['token'];
74 74
         }
75 75
         return null;
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function getDriverBuilderNamespace()
90 90
     {
91
-        $model=$this->getModel();
91
+        $model = $this->getModel();
92 92
 
93
-        if($model=="Default"){
93
+        if ($model=="Default") {
94 94
 
95 95
             return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\UserBuilder';
96 96
         }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function getDriver()
103 103
     {
104
-        $this->driver=ucfirst($this->config['guard'][$this->guard]['driver']);
104
+        $this->driver = ucfirst($this->config['guard'][$this->guard]['driver']);
105 105
 
106 106
         return $this->driver;
107 107
     }
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function getDriverNamespace()
113 113
     {
114
-        $model=$this->getModel();
114
+        $model = $this->getModel();
115 115
 
116
-        if($model=="Default"){
116
+        if ($model=="Default") {
117 117
 
118 118
             return $this->driverDefaultNamespace.'\\'.$this->getDriver().'\\User';
119 119
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function getModel()
134 134
     {
135
-        $this->model=ucfirst($this->config['guard'][$this->guard]['model']);
135
+        $this->model = ucfirst($this->config['guard'][$this->guard]['model']);
136 136
 
137 137
         return $this->model;
138 138
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function store($store)
163 163
     {
164
-        $this->store=$store;
164
+        $this->store = $store;
165 165
 
166 166
         return $this;
167 167
     }
Please login to merge, or discard this patch.