Completed
Pull Request — devel (#20)
by Maxime
36:12
created
src/services/mySql/ClientService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             ->where('id = :id', [':id' => $clientKey])
85 85
             ->one($this->db);
86 86
         if ($entity !== false) {
87
-            throw new DuplicateKeyException('Duplicate key "' . $clientKey . '"');
87
+            throw new DuplicateKeyException('Duplicate key "'.$clientKey.'"');
88 88
         }
89 89
         $values = $client->getDirtyAttributes($attributes);
90 90
         $clientParameters = [];
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 ->where('id = :id', [':id' => $values[$modelKey]])
163 163
                 ->one($this->db);
164 164
             if ($entity !== false) {
165
-                throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"');
165
+                throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"');
166 166
             }
167 167
         }
168 168
         $clientKey = isset($values[$modelKey]) ? $values[$modelKey] : $client->getKey();
Please login to merge, or discard this patch.
src/services/mySql/AuthCodeService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             ->where('id = :id', [':id' => $authCodeKey])
72 72
             ->one($this->db);
73 73
         if ($entity !== false) {
74
-            throw new DuplicateKeyException('Duplicate key "' . $authCodeKey . '"');
74
+            throw new DuplicateKeyException('Duplicate key "'.$authCodeKey.'"');
75 75
         }
76 76
         $values = $authCode->getDirtyAttributes($attributes);
77 77
         $authCodeParameters = [];
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 ->where('id = :id', [':id' => $values[$modelKey]])
138 138
                 ->one($this->db);
139 139
             if ($entity !== false) {
140
-                throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"');
140
+                throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"');
141 141
             }
142 142
         }
143 143
         $authCodeKey = isset($values[$modelKey]) ? $values[$modelKey] : $authCode->getKey();
Please login to merge, or discard this patch.
src/services/mySql/ScopeService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             ->where('id = :id', [':id' => $scope->id])
73 73
             ->one($this->db);
74 74
         if ($entity !== false) {
75
-            throw new DuplicateKeyException('Duplicate key "' . $scope->id . '"');
75
+            throw new DuplicateKeyException('Duplicate key "'.$scope->id.'"');
76 76
         }
77 77
         $values = $scope->getDirtyAttributes($attributes);
78 78
         $scopeParameters = [];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 ->where('id = :id', [':id' => $values[$modelKey]])
127 127
                 ->one($this->db);
128 128
             if ($entity !== false) {
129
-                throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"');
129
+                throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"');
130 130
             }
131 131
         }
132 132
         $scopeKey = isset($values[$modelKey]) ? $values[$modelKey] : $scope->getKey();
Please login to merge, or discard this patch.
src/services/mySql/CypherKeyService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             ->where('id = :id', [':id' => $cypherKeyKey])
67 67
             ->one($this->db);
68 68
         if ($entity !== false) {
69
-            throw new DuplicateKeyException('Duplicate key "' . $cypherKeyKey . '"');
69
+            throw new DuplicateKeyException('Duplicate key "'.$cypherKeyKey.'"');
70 70
         }
71 71
         $values = $cypherKey->getDirtyAttributes($attributes);
72 72
         $cypherKeyParameters = [];
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                 ->where('id = :id', [':id' => $values[$modelKey]])
121 121
                 ->one($this->db);
122 122
             if ($entity !== false) {
123
-                throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"');
123
+                throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"');
124 124
             }
125 125
         }
126 126
         $cypherKeyKey = isset($values[$modelKey]) ? $values[$modelKey] : $cypherKey->getKey();
Please login to merge, or discard this patch.
src/services/mySql/JtiService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             ->where('id = :id', [':id' => $jtiKey])
68 68
             ->one($this->db);
69 69
         if ($entity !== false) {
70
-            throw new DuplicateKeyException('Duplicate key "' . $jtiKey . '"');
70
+            throw new DuplicateKeyException('Duplicate key "'.$jtiKey.'"');
71 71
         }
72 72
         $values = $jti->getDirtyAttributes($attributes);
73 73
         $jtisParameters = [];
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 ->where('id = :id', [':id' => $values[$modelKey]])
122 122
                 ->one($this->db);
123 123
             if ($entity !== false) {
124
-                throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"');
124
+                throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"');
125 125
             }
126 126
         }
127 127
         $jtiKey = isset($values[$modelKey]) ? $values[$modelKey] : $jti->getKey();
Please login to merge, or discard this patch.
src/controllers/AuthorizeController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@
 block discarded – undo
233 233
                     } else {
234 234
                         Yii::$app->session->setFlash('error', [
235 235
                             'error' => 'invalid_scope',
236
-                            'error_description' => 'Scope ' . $scope . ' does not exist.',
236
+                            'error_description' => 'Scope '.$scope.' does not exist.',
237 237
                         ], false);
238 238
                         return $this->redirect(['error']);
239 239
                     }
Please login to merge, or discard this patch.
src/Module.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     /**
193 193
      * @var int duration of login time for multiple authorize calls
194 194
      */
195
-    public $loginDuration = 60 * 60 * 24 * 30;
195
+    public $loginDuration = 60*60*24*30;
196 196
 
197 197
     /**
198 198
      * @var bool configure authorization code (enforce_redirect)
@@ -273,19 +273,19 @@  discard block
 block discarded – undo
273 273
         }
274 274
         $this->setUpDi($app);
275 275
         if (empty($this->baseEndPoint) === false) {
276
-            $this->baseEndPoint = trim($this->baseEndPoint, '/') . '/';
276
+            $this->baseEndPoint = trim($this->baseEndPoint, '/').'/';
277 277
         }
278 278
 
279 279
         if ($app instanceof ConsoleApplication) {
280 280
             $this->mapConsoleControllers($app);
281 281
         } else {
282 282
             $app->getUrlManager()->addRules([
283
-                ['verb' => 'POST', 'pattern' => $this->baseEndPoint . 'token', 'route' => $this->id . '/token/index'],
284
-                ['verb' => 'OPTIONS', 'pattern' => $this->baseEndPoint . 'token', 'route' => $this->id . '/token/options'],
285
-                ['verb' => 'GET', 'pattern' => $this->baseEndPoint . 'authorize', 'route' => $this->id . '/authorize/index'],
286
-                ['pattern' => $this->baseEndPoint . 'authorize-login', 'route' => $this->id . '/authorize/login'],
287
-                ['pattern' => $this->baseEndPoint . 'authorize-application', 'route' => $this->id . '/authorize/authorize'],
288
-                ['pattern' => $this->baseEndPoint . 'authorize-error', 'route' => $this->id . '/authorize/error'],
283
+                ['verb' => 'POST', 'pattern' => $this->baseEndPoint.'token', 'route' => $this->id.'/token/index'],
284
+                ['verb' => 'OPTIONS', 'pattern' => $this->baseEndPoint.'token', 'route' => $this->id.'/token/options'],
285
+                ['verb' => 'GET', 'pattern' => $this->baseEndPoint.'authorize', 'route' => $this->id.'/authorize/index'],
286
+                ['pattern' => $this->baseEndPoint.'authorize-login', 'route' => $this->id.'/authorize/login'],
287
+                ['pattern' => $this->baseEndPoint.'authorize-application', 'route' => $this->id.'/authorize/authorize'],
288
+                ['pattern' => $this->baseEndPoint.'authorize-error', 'route' => $this->id.'/authorize/error'],
289 289
             ]);
290 290
         }
291 291
     }
Please login to merge, or discard this patch.
src/commands/ScopeController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
         $scope->isDefault = (bool)$this->isDefault;
64 64
         $scope->definition = $this->definition;
65 65
         if ($scope->save() === true) {
66
-            $this->stdout('Scope created :' . "\n");
67
-            $this->stdout(' - id: ' . $scope->id . "\n");
68
-            $this->stdout(' - isDefault: ' . ($scope->isDefault ? 'Yes' : 'No') . "\n");
69
-            $this->stdout(' - definition: ' . $scope->definition . "\n");
66
+            $this->stdout('Scope created :'."\n");
67
+            $this->stdout(' - id: '.$scope->id."\n");
68
+            $this->stdout(' - isDefault: '.($scope->isDefault ? 'Yes' : 'No')."\n");
69
+            $this->stdout(' - definition: '.$scope->definition."\n");
70 70
             return ExitCode::OK;
71 71
         } else {
72
-            $this->stdout('Scope cannot be created.' . "\n");
72
+            $this->stdout('Scope cannot be created.'."\n");
73 73
             return ExitCode::UNSPECIFIED_ERROR;
74 74
         }
75 75
     }
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
             $scope->isDefault = $this->isDefault;
92 92
             $scope->definition = $this->definition;
93 93
             if ($scope->save() === true) {
94
-                $this->stdout('Scope updated :' . "\n");
95
-                $this->stdout(' - id: ' . $scope->id . "\n");
96
-                $this->stdout(' - isDefault: ' . ($scope->isDefault ? 'Yes' : 'No') . "\n");
97
-                $this->stdout(' - definition: ' . $scope->definition . "\n");
94
+                $this->stdout('Scope updated :'."\n");
95
+                $this->stdout(' - id: '.$scope->id."\n");
96
+                $this->stdout(' - isDefault: '.($scope->isDefault ? 'Yes' : 'No')."\n");
97
+                $this->stdout(' - definition: '.$scope->definition."\n");
98 98
                 return ExitCode::OK;
99 99
             } else {
100
-                $this->stdout('Scope ' . $id . ' cannot be updated' . "\n");
100
+                $this->stdout('Scope '.$id.' cannot be updated'."\n");
101 101
                 return ExitCode::UNSPECIFIED_ERROR;
102 102
             }
103 103
         } else {
104
-            $this->stdout('Scope ' . $id . ' does not exist' . "\n");
104
+            $this->stdout('Scope '.$id.' does not exist'."\n");
105 105
             return ExitCode::UNSPECIFIED_ERROR;
106 106
         }
107 107
     }
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
         $scope = $scopeClass::findOne($id);
122 122
         if ($scope !== null) {
123 123
             if ($scope->delete() === true) {
124
-                $this->stdout('Scope ' . $id . ' deleted' . "\n");
124
+                $this->stdout('Scope '.$id.' deleted'."\n");
125 125
                 return ExitCode::OK;
126 126
             } else {
127
-                $this->stdout('Scope ' . $id . ' cannot be deleted' . "\n");
127
+                $this->stdout('Scope '.$id.' cannot be deleted'."\n");
128 128
                 return ExitCode::UNSPECIFIED_ERROR;
129 129
             }
130 130
         } else {
131
-            $this->stdout('Scope ' . $id . ' does not exist' . "\n");
131
+            $this->stdout('Scope '.$id.' does not exist'."\n");
132 132
             return ExitCode::UNSPECIFIED_ERROR;
133 133
         }
134 134
     }
Please login to merge, or discard this patch.
src/commands/ClientController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         $client->scopes = empty($this->scopes) ? null : explode(',', $this->scopes);
80 80
         $client->grantTypes = empty($this->grantTypes) ? null : explode(',', $this->grantTypes);
81 81
         if ($client->save() === true) {
82
-            $this->stdout('Client created :' . "\n");
83
-            $this->stdout(' - id: ' . $client->id . "\n");
84
-            $this->stdout(' - secret: ' . $client->secret . "\n");
85
-            $this->stdout(' - name: ' . $client->name . "\n");
86
-            $this->stdout(' - redirectUri: ' . implode(',', $client->redirectUri) . "\n");
82
+            $this->stdout('Client created :'."\n");
83
+            $this->stdout(' - id: '.$client->id."\n");
84
+            $this->stdout(' - secret: '.$client->secret."\n");
85
+            $this->stdout(' - name: '.$client->name."\n");
86
+            $this->stdout(' - redirectUri: '.implode(',', $client->redirectUri)."\n");
87 87
             return ExitCode::OK;
88 88
         } else {
89
-            $this->stdout('Client cannot be created.' . "\n");
89
+            $this->stdout('Client cannot be created.'."\n");
90 90
             return ExitCode::UNSPECIFIED_ERROR;
91 91
         }
92 92
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected function getRandomString($length = 40)
101 101
     {
102
-        $bytes = (int)$length / 2;
102
+        $bytes = (int)$length/2;
103 103
         return bin2hex(openssl_random_pseudo_bytes($bytes));
104 104
     }
105 105
 
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
             $client->scopes = empty($this->scopes) ? null : explode(',', $this->scopes);
125 125
             $client->grantTypes = empty($this->grantTypes) ? null : explode(',', $this->grantTypes);
126 126
             if ($client->save() === true) {
127
-                $this->stdout('Client updated :' . "\n");
128
-                $this->stdout(' - id: ' . $client->id . "\n");
129
-                $this->stdout(' - secret: ' . $client->secret . "\n");
130
-                $this->stdout(' - name: ' . $client->name . "\n");
131
-                $this->stdout(' - redirectUri: ' . implode(',', $client->redirectUri) . "\n");
127
+                $this->stdout('Client updated :'."\n");
128
+                $this->stdout(' - id: '.$client->id."\n");
129
+                $this->stdout(' - secret: '.$client->secret."\n");
130
+                $this->stdout(' - name: '.$client->name."\n");
131
+                $this->stdout(' - redirectUri: '.implode(',', $client->redirectUri)."\n");
132 132
                 return ExitCode::OK;
133 133
             } else {
134
-                $this->stdout('Client ' . $id . ' cannot be updated.' . "\n");
134
+                $this->stdout('Client '.$id.' cannot be updated.'."\n");
135 135
                 return ExitCode::UNSPECIFIED_ERROR;
136 136
             }
137 137
         } else {
138
-            $this->stdout('Client ' . $id . ' does not exist' . "\n");
138
+            $this->stdout('Client '.$id.' does not exist'."\n");
139 139
             return ExitCode::UNSPECIFIED_ERROR;
140 140
         }
141 141
     }
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
         $client = $clientClass::findOne($id);
156 156
         if ($client !== null) {
157 157
             if ($client->delete() === true) {
158
-                $this->stdout('Client ' . $id . ' deleted' . "\n");
158
+                $this->stdout('Client '.$id.' deleted'."\n");
159 159
                 return ExitCode::OK;
160 160
             } else {
161
-                $this->stdout('Client ' . $id . ' cannot be deleted.' . "\n");
161
+                $this->stdout('Client '.$id.' cannot be deleted.'."\n");
162 162
                 return ExitCode::UNSPECIFIED_ERROR;
163 163
             }
164 164
         } else {
165
-            $this->stdout('Client ' . $id . ' does not exist' . "\n");
165
+            $this->stdout('Client '.$id.' does not exist'."\n");
166 166
             return ExitCode::UNSPECIFIED_ERROR;
167 167
         }
168 168
     }
Please login to merge, or discard this patch.