Completed
Pull Request — devel (#20)
by Maxime
36:12
created
src/commands/JwtController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
             $jwt->publicKey = $publicKey;
77 77
         }
78 78
         if ($jwt->save() === true) {
79
-            $this->stdout('Jwt created :' . "\n");
80
-            $this->stdout(' - id: ' . $jwt->id . "\n");
81
-            $this->stdout(' - clientId: ' . $jwt->clientId . "\n");
82
-            $this->stdout(' - subject: ' . $jwt->subject . "\n");
83
-            $this->stdout(' - publicKey: ' . $jwt->publicKey . "\n");
79
+            $this->stdout('Jwt created :'."\n");
80
+            $this->stdout(' - id: '.$jwt->id."\n");
81
+            $this->stdout(' - clientId: '.$jwt->clientId."\n");
82
+            $this->stdout(' - subject: '.$jwt->subject."\n");
83
+            $this->stdout(' - publicKey: '.$jwt->publicKey."\n");
84 84
             return ExitCode::OK;
85 85
         } else {
86
-            $this->stdout('Jwt cannot be created.' . "\n");
86
+            $this->stdout('Jwt cannot be created.'."\n");
87 87
             return ExitCode::UNSPECIFIED_ERROR;
88 88
         }
89 89
     }
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
             $jwt->subject = $this->subject;
107 107
             $jwt->publicKey = $this->publicKey;
108 108
             if ($jwt->save() === true) {
109
-                $this->stdout('Jwt updated :' . "\n");
110
-                $this->stdout(' - id: ' . $jwt->id . "\n");
111
-                $this->stdout(' - clientId: ' . $jwt->clientId . "\n");
112
-                $this->stdout(' - subject: ' . $jwt->subject . "\n");
113
-                $this->stdout(' - publicKey: ' . $jwt->publicKey . "\n");
109
+                $this->stdout('Jwt updated :'."\n");
110
+                $this->stdout(' - id: '.$jwt->id."\n");
111
+                $this->stdout(' - clientId: '.$jwt->clientId."\n");
112
+                $this->stdout(' - subject: '.$jwt->subject."\n");
113
+                $this->stdout(' - publicKey: '.$jwt->publicKey."\n");
114 114
                 return ExitCode::OK;
115 115
             } else {
116
-                $this->stdout('Jwt ' . $id . ' cannot be updated' . "\n");
116
+                $this->stdout('Jwt '.$id.' cannot be updated'."\n");
117 117
                 return ExitCode::UNSPECIFIED_ERROR;
118 118
             }
119 119
         } else {
120
-            $this->stdout('Jwt ' . $id . ' does not exist' . "\n");
120
+            $this->stdout('Jwt '.$id.' does not exist'."\n");
121 121
             return ExitCode::UNSPECIFIED_ERROR;
122 122
         }
123 123
     }
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
         $jwt = $jwtClass::findOne($id);
138 138
         if ($jwt !== null) {
139 139
             if ($jwt->delete() === true) {
140
-                $this->stdout('Jwt ' . $id . ' deleted' . "\n");
140
+                $this->stdout('Jwt '.$id.' deleted'."\n");
141 141
                 return ExitCode::OK;
142 142
             } else {
143
-                $this->stdout('Jwt ' . $id . ' cannot be deleted' . "\n");
143
+                $this->stdout('Jwt '.$id.' cannot be deleted'."\n");
144 144
                 return ExitCode::UNSPECIFIED_ERROR;
145 145
             }
146 146
         } else {
147
-            $this->stdout('Jwt ' . $id . ' does not exist' . "\n");
147
+            $this->stdout('Jwt '.$id.' does not exist'."\n");
148 148
             return ExitCode::UNSPECIFIED_ERROR;
149 149
         }
150 150
     }
Please login to merge, or discard this patch.
src/commands/MigrateRedisController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             /// AccessToken
31 31
             ///
32 32
             ///////////////
33
-            $this->stdout('Start migrating AccessTokens ...' . "\n");
33
+            $this->stdout('Start migrating AccessTokens ...'."\n");
34 34
             /** @var AccessTokenService $accessTokenService */
35 35
             $accessTokenService = Yii::createObject('sweelix\oauth2\server\interfaces\AccessTokenServiceInterface');
36 36
             $accessTokenList = $accessTokenService->getAccessTokenListKey();
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
                     }
81 81
                 }
82 82
             }
83
-            $this->stdout('Done migrating AccessTokens !' . "\n");
83
+            $this->stdout('Done migrating AccessTokens !'."\n");
84 84
 
85 85
             ///////////////
86 86
             ///
87 87
             /// Clients
88 88
             ///
89 89
             ///////////////
90
-            $this->stdout('Start migrating Clients ...' . "\n");
90
+            $this->stdout('Start migrating Clients ...'."\n");
91 91
             /** @var ClientService $clientService */
92 92
             $clientService = Yii::createObject('sweelix\oauth2\server\interfaces\ClientServiceInterface');
93 93
             $clientList = $clientService->getClientListKey();
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
                     $db->executeCommand('SADD', [$clientService->getClientListKey(), $clientData[1]]);
112 112
                 }
113 113
             }
114
-            $this->stdout('Done migrating Clients !' . "\n");
114
+            $this->stdout('Done migrating Clients !'."\n");
115 115
 
116 116
             ///////////////
117 117
             ///
118 118
             /// Jti
119 119
             ///
120 120
             ///////////////
121
-            $this->stdout('Start migrating Jtis ...' . "\n");
121
+            $this->stdout('Start migrating Jtis ...'."\n");
122 122
             /** @var JtiService $jtiService */
123 123
             $jtiService = Yii::createObject('sweelix\oauth2\server\interfaces\JtiServiceInterface');
124 124
             $jtiList = $jtiService->getJtiListKey();
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
                     }
158 158
                 }
159 159
             }
160
-            $this->stdout('Done migrating Jtis !' . "\n");
160
+            $this->stdout('Done migrating Jtis !'."\n");
161 161
 
162 162
             ///////////////
163 163
             ///
164 164
             /// RefreshToken
165 165
             ///
166 166
             ///////////////
167
-            $this->stdout('Start migrating RefreshTokens ...' . "\n");
167
+            $this->stdout('Start migrating RefreshTokens ...'."\n");
168 168
             /** @var RefreshTokenService $refreshTokenService */
169 169
             $refreshTokenService = Yii::createObject('sweelix\oauth2\server\interfaces\RefreshTokenServiceInterface');
170 170
             $refreshTokenList = $refreshTokenService->getRefreshTokenListKey();
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
                     }
204 204
                 }
205 205
             }
206
-            $this->stdout('Done migrating RefreshTokens !' . "\n");
206
+            $this->stdout('Done migrating RefreshTokens !'."\n");
207 207
 
208
-            $this->stdout('Migration done !' . "\n");
208
+            $this->stdout('Migration done !'."\n");
209 209
             $exitCode = ExitCode::OK;
210 210
         } catch (\Exception $e) {
211
-            $this->stderr($e->getMessage() . "\n");
211
+            $this->stderr($e->getMessage()."\n");
212 212
             $exitCode = ExitCode::getReason($e->getCode());
213 213
         }
214 214
         return $exitCode;
Please login to merge, or discard this patch.
src/services/redis/AccessTokenService.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function getAccessTokenKey($aid)
57 57
     {
58
-        return $this->namespace . ':' . $aid;
58
+        return $this->namespace.':'.$aid;
59 59
     }
60 60
 
61 61
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getUserAccessTokensKey($uid)
67 67
     {
68
-        return $this->userNamespace . ':' . $uid . ':accessTokens';
68
+        return $this->userNamespace.':'.$uid.':accessTokens';
69 69
     }
70 70
 
71 71
     /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function getClientAccessTokensKey($cid)
77 77
     {
78
-        return $this->clientNamespace . ':' . $cid . ':accessTokens';
78
+        return $this->clientNamespace.':'.$cid.':accessTokens';
79 79
     }
80 80
 
81 81
     /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function getAccessTokenListKey()
85 85
     {
86
-        return $this->namespace . ':keys';
86
+        return $this->namespace.':keys';
87 87
     }
88 88
 
89 89
     /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function getUserListKey()
93 93
     {
94
-        return $this->userNamespace . ':keys';
94
+        return $this->userNamespace.':keys';
95 95
     }
96 96
 
97 97
     /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         //check if record exists
138 138
         $entityStatus = (int)$this->db->executeCommand('EXISTS', [$accessTokenKey]);
139 139
         if ($entityStatus === 1) {
140
-            throw new DuplicateKeyException('Duplicate key "' . $accessTokenKey . '"');
140
+            throw new DuplicateKeyException('Duplicate key "'.$accessTokenKey.'"');
141 141
         }
142 142
 
143 143
         $values = $accessToken->getDirtyAttributes($attributes);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             $newAccessTokenKey = $this->getAccessTokenKey($values[$modelKey]);
218 218
             $entityStatus = (int)$this->db->executeCommand('EXISTS', [$newAccessTokenKey]);
219 219
             if ($entityStatus === 1) {
220
-                throw new DuplicateKeyException('Duplicate key "' . $newAccessTokenKey . '"');
220
+                throw new DuplicateKeyException('Duplicate key "'.$newAccessTokenKey.'"');
221 221
             }
222 222
         }
223 223
 
Please login to merge, or discard this patch.
src/services/redis/JtiService.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function getJtiKey($jid)
55 55
     {
56
-        return $this->namespace . ':' . $jid;
56
+        return $this->namespace.':'.$jid;
57 57
     }
58 58
 
59 59
     /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function getSubjectJtisKey($sid)
64 64
     {
65
-        return $this->subjectNamespace . ':' . $sid . ':jtis';
65
+        return $this->subjectNamespace.':'.$sid.':jtis';
66 66
     }
67 67
 
68 68
     /**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getClientJtisKey($cid)
73 73
     {
74
-        return $this->clientNamespace . ':' . $cid . ':jtis';
74
+        return $this->clientNamespace.':'.$cid.':jtis';
75 75
     }
76 76
 
77 77
     /**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function getJtiListKey()
81 81
     {
82
-        return $this->namespace . ':keys';
82
+        return $this->namespace.':keys';
83 83
     }
84 84
 
85 85
     /**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function getSubjectListKey()
89 89
     {
90
-        return $this->subjectNamespace . ':keys';
90
+        return $this->subjectNamespace.':keys';
91 91
     }
92 92
 
93 93
     /**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         //check if record exists
134 134
         $entityStatus = (int)$this->db->executeCommand('EXISTS', [$jtiKey]);
135 135
         if ($entityStatus === 1) {
136
-            throw new DuplicateKeyException('Duplicate key "' . $jtiKey . '"');
136
+            throw new DuplicateKeyException('Duplicate key "'.$jtiKey.'"');
137 137
         }
138 138
 
139 139
         $values = $jti->getDirtyAttributes($attributes);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $newJtiKey = $this->getJtiKey($values[$modelKey]);
214 214
             $entityStatus = (int)$this->db->executeCommand('EXISTS', [$newJtiKey]);
215 215
             if ($entityStatus === 1) {
216
-                throw new DuplicateKeyException('Duplicate key "' . $newJtiKey . '"');
216
+                throw new DuplicateKeyException('Duplicate key "'.$newJtiKey.'"');
217 217
             }
218 218
         }
219 219
 
Please login to merge, or discard this patch.
src/services/redis/ClientService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getClientKey($cid)
52 52
     {
53
-        return $this->namespace . ':' . $cid;
53
+        return $this->namespace.':'.$cid;
54 54
     }
55 55
 
56 56
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function getClientUsersListKey($cid)
62 62
     {
63
-        return $this->namespace . ':' . $cid . ':users';
63
+        return $this->namespace.':'.$cid.':users';
64 64
     }
65 65
 
66 66
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getUserClientsListKey($uid)
72 72
     {
73
-        return $this->userNamespace . ':' . $uid . ':clients';
73
+        return $this->userNamespace.':'.$uid.':clients';
74 74
     }
75 75
 
76 76
     /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function getClientListKey()
80 80
     {
81
-        return $this->namespace . ':keys';
81
+        return $this->namespace.':keys';
82 82
     }
83 83
 
84 84
     /**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         //check if record exists
116 116
         $entityStatus = (int)$this->db->executeCommand('EXISTS', [$clientKey]);
117 117
         if ($entityStatus === 1) {
118
-            throw new DuplicateKeyException('Duplicate key "' . $clientKey . '"');
118
+            throw new DuplicateKeyException('Duplicate key "'.$clientKey.'"');
119 119
         }
120 120
 
121 121
         $values = $client->getDirtyAttributes($attributes);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             $newClientKey = $this->getClientKey($values[$modelKey]);
176 176
             $entityStatus = (int)$this->db->executeCommand('EXISTS', [$newClientKey]);
177 177
             if ($entityStatus === 1) {
178
-                throw new DuplicateKeyException('Duplicate key "' . $newClientKey . '"');
178
+                throw new DuplicateKeyException('Duplicate key "'.$newClientKey.'"');
179 179
             }
180 180
         }
181 181
 
Please login to merge, or discard this patch.
src/services/redis/RefreshTokenService.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function getRefreshTokenKey($rid)
57 57
     {
58
-        return $this->namespace . ':' . $rid;
58
+        return $this->namespace.':'.$rid;
59 59
     }
60 60
 
61 61
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getUserRefreshTokensKey($uid)
67 67
     {
68
-        return $this->userNamespace . ':' . $uid . ':refreshTokens';
68
+        return $this->userNamespace.':'.$uid.':refreshTokens';
69 69
     }
70 70
 
71 71
     /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function getClientRefreshTokensKey($cid)
77 77
     {
78
-        return $this->clientNamespace . ':' . $cid . ':refreshTokens';
78
+        return $this->clientNamespace.':'.$cid.':refreshTokens';
79 79
     }
80 80
 
81 81
     /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function getRefreshTokenListKey()
85 85
     {
86
-        return $this->namespace . ':keys';
86
+        return $this->namespace.':keys';
87 87
     }
88 88
 
89 89
     /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function getUserListKey()
93 93
     {
94
-        return $this->userNamespace . ':keys';
94
+        return $this->userNamespace.':keys';
95 95
     }
96 96
 
97 97
     /**
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         $userRefreshTokens = $this->db->executeCommand('ZRANGE', [$userRefreshTokensKey, 0, -1]);
342 342
         $refreshTokens = [];
343 343
         if ((is_array($userRefreshTokens) === true) && (count($userRefreshTokens) > 0)) {
344
-            foreach($userRefreshTokens as $userRefreshTokenId) {
344
+            foreach ($userRefreshTokens as $userRefreshTokenId) {
345 345
                 $refreshTokens[] = $this->findOne($userRefreshTokenId);
346 346
             }
347 347
         }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         $clientRefreshTokens = $this->db->executeCommand('ZRANGE', [$clientRefreshTokensKey, 0, -1]);
374 374
         $refreshTokens = [];
375 375
         if ((is_array($clientRefreshTokens) === true) && (count($clientRefreshTokens) > 0)) {
376
-            foreach($clientRefreshTokens as $clientRefreshTokenId) {
376
+            foreach ($clientRefreshTokens as $clientRefreshTokenId) {
377 377
                 $refreshTokens[] = $this->findOne($clientRefreshTokenId);
378 378
             }
379 379
         }
Please login to merge, or discard this patch.