@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | protected function getClientKey($cid) |
53 | 53 | { |
54 | - return $this->namespace . ':' . $cid; |
|
54 | + return $this->namespace.':'.$cid; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function getClientUsersListKey($cid) |
63 | 63 | { |
64 | - return $this->namespace . ':' . $cid . ':users'; |
|
64 | + return $this->namespace.':'.$cid.':users'; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function getUserClientsListKey($uid) |
73 | 73 | { |
74 | - return $this->userNamespace . ':' . $uid . ':clients'; |
|
74 | + return $this->userNamespace.':'.$uid.':clients'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | $this->db->executeCommand('MULTI'); |
269 | 269 | // remove client from all userClient sets |
270 | - foreach($usersList as $user) { |
|
270 | + foreach ($usersList as $user) { |
|
271 | 271 | $userClientKey = $this->getUserClientsListKey($user); |
272 | 272 | $this->db->executeCommand('SREM', [$userClientKey, $id]); |
273 | 273 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $userClientsListKey = $this->getUserClientsListKey($userId); |
333 | 333 | $clientsList = $this->db->executeCommand('SMEMBERS', [$userClientsListKey]); |
334 | 334 | $clients = []; |
335 | - foreach($clientsList as $clientId) { |
|
335 | + foreach ($clientsList as $clientId) { |
|
336 | 336 | $result = $this->findOne($clientId); |
337 | 337 | if ($result instanceof ClientModelInterface) { |
338 | 338 | $clients[] = $result; |
@@ -191,7 +191,7 @@ |
||
191 | 191 | /** |
192 | 192 | * @var int duration of login time for multiple authorize calls |
193 | 193 | */ |
194 | - public $loginDuration = 60 * 60 * 24 * 30; |
|
194 | + public $loginDuration = 60*60*24*30; |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * @var bool configure authorization code (enforce_redirect) |
@@ -18,7 +18,6 @@ |
||
18 | 18 | use yii\base\InvalidArgumentException; |
19 | 19 | use yii\base\Model; |
20 | 20 | use yii\base\ModelEvent; |
21 | -use Yii; |
|
22 | 21 | use Exception; |
23 | 22 | use yii\base\NotSupportedException; |
24 | 23 | use yii\helpers\Inflector; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if ($this->hasAttribute($name)) { |
172 | 172 | $this->_attributes[$name] = $value; |
173 | 173 | } else { |
174 | - throw new InvalidArgumentException(get_class($this) . ' has no attribute named "' . $name . '".'); |
|
174 | + throw new InvalidArgumentException(get_class($this).' has no attribute named "'.$name.'".'); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if (isset($this->_oldAttributes[$name]) || $this->hasAttribute($name)) { |
209 | 209 | $this->_oldAttributes[$name] = $value; |
210 | 210 | } else { |
211 | - throw new InvalidArgumentException(get_class($this) . ' has no attribute named "' . $name . '".'); |
|
211 | + throw new InvalidArgumentException(get_class($this).' has no attribute named "'.$name.'".'); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | * If not set, [[formName()]] will be used. |
383 | 383 | * @return boolean whether the model is successfully populated with some data. |
384 | 384 | */ |
385 | - public function loadIds($data, $formName=null) |
|
385 | + public function loadIds($data, $formName = null) |
|
386 | 386 | { |
387 | 387 | $camelData = []; |
388 | - foreach($data as $key => $value) { |
|
388 | + foreach ($data as $key => $value) { |
|
389 | 389 | $key = lcfirst(Inflector::id2camel($key)); |
390 | 390 | $camelData[$key] = $value; |
391 | 391 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | $client->grantTypes = empty($this->grantTypes) ? null : explode(',', $this->grantTypes); |
78 | 78 | if ($client->save() === true) { |
79 | 79 | $this->stdout('Client created :'."\n"); |
80 | - $this->stdout(' - id: ' . $client->id . "\n"); |
|
81 | - $this->stdout(' - secret: ' . $client->secret . "\n"); |
|
82 | - $this->stdout(' - name: ' . $client->name . "\n"); |
|
83 | - $this->stdout(' - redirectUri: ' . implode(',', $client->redirectUri) . "\n"); |
|
80 | + $this->stdout(' - id: '.$client->id."\n"); |
|
81 | + $this->stdout(' - secret: '.$client->secret."\n"); |
|
82 | + $this->stdout(' - name: '.$client->name."\n"); |
|
83 | + $this->stdout(' - redirectUri: '.implode(',', $client->redirectUri)."\n"); |
|
84 | 84 | return ExitCode::OK; |
85 | 85 | } else { |
86 | 86 | $this->stdout('Client cannot be created.'."\n"); |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | $client->scopes = empty($this->scopes) ? null : explode(',', $this->scopes); |
100 | 100 | $client->grantTypes = empty($this->grantTypes) ? null : explode(',', $this->grantTypes); |
101 | 101 | if ($client->save() === true) { |
102 | - $this->stdout('Client updated :' . "\n"); |
|
103 | - $this->stdout(' - id: ' . $client->id . "\n"); |
|
104 | - $this->stdout(' - secret: ' . $client->secret . "\n"); |
|
105 | - $this->stdout(' - name: ' . $client->name . "\n"); |
|
106 | - $this->stdout(' - redirectUri: ' . implode(',', $client->redirectUri) . "\n"); |
|
102 | + $this->stdout('Client updated :'."\n"); |
|
103 | + $this->stdout(' - id: '.$client->id."\n"); |
|
104 | + $this->stdout(' - secret: '.$client->secret."\n"); |
|
105 | + $this->stdout(' - name: '.$client->name."\n"); |
|
106 | + $this->stdout(' - redirectUri: '.implode(',', $client->redirectUri)."\n"); |
|
107 | 107 | return ExitCode::OK; |
108 | 108 | } else { |
109 | 109 | $this->stdout('Client cannot be updated.'."\n"); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | protected function getRandomString($length = 40) |
125 | 125 | { |
126 | - $bytes = (int) $length/2; |
|
126 | + $bytes = (int)$length/2; |
|
127 | 127 | return bin2hex(openssl_random_pseudo_bytes($bytes)); |
128 | 128 | } |
129 | 129 | } |
@@ -20,7 +20,6 @@ |
||
20 | 20 | use sweelix\oauth2\server\interfaces\JtiServiceInterface; |
21 | 21 | use yii\db\Exception as DatabaseException; |
22 | 22 | use Yii; |
23 | -use Exception; |
|
24 | 23 | use yii\db\Expression; |
25 | 24 | use yii\db\Query; |
26 | 25 |
@@ -67,7 +67,7 @@ discard block |
||
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 |
||
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(); |
@@ -20,7 +20,6 @@ |
||
20 | 20 | use sweelix\oauth2\server\interfaces\JwtServiceInterface; |
21 | 21 | use yii\db\Exception as DatabaseException; |
22 | 22 | use Yii; |
23 | -use Exception; |
|
24 | 23 | use yii\db\Expression; |
25 | 24 | use yii\db\Query; |
26 | 25 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ->where('id = :id', [':id' => $jwt->id]) |
67 | 67 | ->one($this->db); |
68 | 68 | if ($entity !== false) { |
69 | - throw new DuplicateKeyException('Duplicate key "' . $jwt->id . '"'); |
|
69 | + throw new DuplicateKeyException('Duplicate key "'.$jwt->id.'"'); |
|
70 | 70 | } |
71 | 71 | $values = $jwt->getDirtyAttributes($attributes); |
72 | 72 | $jwtParameters = []; |
@@ -120,7 +120,7 @@ discard block |
||
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 | $jwtKey = isset($values[$modelKey]) ? $values[$modelKey] : $jwt->getKey(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | if ((isset($this->attributesDefinitions[$key]) === true) |
57 | 57 | && (in_array($this->attributesDefinitions[$key], $bypassTypes) === false) |
58 | 58 | ) { |
59 | - switch($this->attributesDefinitions[$key]) { |
|
59 | + switch ($this->attributesDefinitions[$key]) { |
|
60 | 60 | case 'bool': |
61 | 61 | case 'boolean': |
62 | 62 | $value = $value ? 1 : 0; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | switch ($this->attributesDefinitions[$key]) { |
99 | 99 | case 'bool': |
100 | 100 | case 'boolean': |
101 | - $value = (bool) $value; |
|
101 | + $value = (bool)$value; |
|
102 | 102 | break; |
103 | 103 | case 'int': |
104 | 104 | case 'integer': |
105 | - $value = (int) $value; |
|
105 | + $value = (int)$value; |
|
106 | 106 | break; |
107 | 107 | case 'array': |
108 | 108 | if (is_array($value) === false) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | case 'real': |
120 | 120 | case 'double': |
121 | 121 | case 'float': |
122 | - $value = (float) $value; |
|
122 | + $value = (float)$value; |
|
123 | 123 | break; |
124 | 124 | } |
125 | 125 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ->where('id = :id', [':id' => $accessTokenKey]) |
70 | 70 | ->one($this->db); |
71 | 71 | if ($entity !== false) { |
72 | - throw new DuplicateKeyException('Duplicate key "' . $accessTokenKey . '"'); |
|
72 | + throw new DuplicateKeyException('Duplicate key "'.$accessTokenKey.'"'); |
|
73 | 73 | } |
74 | 74 | $values = $accessToken->getDirtyAttributes($attributes); |
75 | 75 | $accessTokenParameters = []; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ->where('id = :id', [':id' => $values[$modelKey]]) |
136 | 136 | ->one($this->db); |
137 | 137 | if ($entity !== false) { |
138 | - throw new DuplicateKeyException('Duplicate key "' . $values[$modelKey] . '"'); |
|
138 | + throw new DuplicateKeyException('Duplicate key "'.$values[$modelKey].'"'); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | $accessTokenKey = isset($values[$modelKey]) ? $values[$modelKey] : $accessToken->getKey(); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | protected function encodeAttributes(Array $attributes) |
79 | 79 | { |
80 | 80 | $data = Json::encode($attributes); |
81 | - $etag = '"' . rtrim(base64_encode(sha1($data, true)), '=') . '"'; |
|
81 | + $etag = '"'.rtrim(base64_encode(sha1($data, true)), '=').'"'; |
|
82 | 82 | return $etag; |
83 | 83 | } |
84 | 84 |