@@ -16,7 +16,6 @@ |
||
| 16 | 16 | |
| 17 | 17 | use OAuth2\Request as OAuth2Request; |
| 18 | 18 | use OAuth2\Response as OAuth2Response; |
| 19 | -use sweelix\oauth2\server\models\Client; |
|
| 20 | 19 | use sweelix\oauth2\server\models\Scope; |
| 21 | 20 | use sweelix\oauth2\server\Module; |
| 22 | 21 | use yii\web\Controller; |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | $requestedScopes = []; |
| 119 | 119 | if (empty($additionalScopes) === false) { |
| 120 | 120 | $additionalScopes = explode(' ', $additionalScopes); |
| 121 | - foreach($additionalScopes as $scope) { |
|
| 121 | + foreach ($additionalScopes as $scope) { |
|
| 122 | 122 | $dbScope = Scope::findOne($scope); |
| 123 | 123 | if ($dbScope !== null) { |
| 124 | 124 | $requestedScopes[] = [ |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * Returns the old key value of the object |
| 132 | - * @return mixed|null |
|
| 132 | + * @return string |
|
| 133 | 133 | * @since XXX |
| 134 | 134 | */ |
| 135 | 135 | public function getOldKey() |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * If this record is the result of a query and the attribute is not loaded, |
| 218 | 218 | * null will be returned. |
| 219 | 219 | * @param string $name the attribute name |
| 220 | - * @return mixed the old attribute value. Null if the attribute is not loaded before |
|
| 220 | + * @return string the old attribute value. Null if the attribute is not loaded before |
|
| 221 | 221 | * or does not exist. |
| 222 | 222 | * @see hasAttribute() |
| 223 | 223 | */ |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use yii\base\InvalidParamException; |
| 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 InvalidParamException(get_class($this) . ' has no attribute named "' . $name . '".'); |
|
| 174 | + throw new InvalidParamException(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 InvalidParamException(get_class($this) . ' has no attribute named "' . $name . '".'); |
|
| 211 | + throw new InvalidParamException(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 | } |
@@ -85,6 +85,7 @@ |
||
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @param mixed $config |
| 88 | + * @param \yii\base\Module|null $module |
|
| 88 | 89 | * @return array Oauth server configuration |
| 89 | 90 | * @since XXX |
| 90 | 91 | */ |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | namespace sweelix\oauth2\server\services\redis; |
| 16 | 16 | |
| 17 | 17 | use sweelix\oauth2\server\interfaces\BaseModelInterface; |
| 18 | -use sweelix\oauth2\server\models\BaseModel; |
|
| 19 | 18 | use sweelix\oauth2\server\traits\redis\TypeConverter; |
| 20 | 19 | use yii\base\Object; |
| 21 | 20 | use yii\helpers\Json; |
@@ -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 | |
@@ -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 | |
| 25 | 24 | /** |
| 26 | 25 | * This is the jti service for redis |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | protected function getJtiKey($jid) |
| 47 | 47 | { |
| 48 | - return $this->namespace . ':' . $jid; |
|
| 48 | + return $this->namespace.':'.$jid; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -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 | |
| 25 | 24 | /** |
| 26 | 25 | * This is the jwt service for redis |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | protected function getJwtKey($jid) |
| 47 | 47 | { |
| 48 | - return $this->namespace . ':' . $jid; |
|
| 48 | + return $this->namespace.':'.$jid; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -73,10 +73,10 @@ discard block |
||
| 73 | 73 | $client->grantTypes = empty($this->grantTypes) ? null : explode(',', $this->grantTypes); |
| 74 | 74 | if ($client->save() === true) { |
| 75 | 75 | $this->stdout('Client created :'."\n"); |
| 76 | - $this->stdout(' - id: ' . $client->id . "\n"); |
|
| 77 | - $this->stdout(' - secret: ' . $client->secret . "\n"); |
|
| 78 | - $this->stdout(' - name: ' . $client->name . "\n"); |
|
| 79 | - $this->stdout(' - redirectUri: ' . $client->redirectUri . "\n"); |
|
| 76 | + $this->stdout(' - id: '.$client->id."\n"); |
|
| 77 | + $this->stdout(' - secret: '.$client->secret."\n"); |
|
| 78 | + $this->stdout(' - name: '.$client->name."\n"); |
|
| 79 | + $this->stdout(' - redirectUri: '.$client->redirectUri."\n"); |
|
| 80 | 80 | } else { |
| 81 | 81 | $this->stdout('Client cannot be created.'."\n"); |
| 82 | 82 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function getRandomString($length = 40) |
| 92 | 92 | { |
| 93 | - $bytes = (int) $length/2; |
|
| 93 | + $bytes = (int)$length/2; |
|
| 94 | 94 | return bin2hex(openssl_random_pseudo_bytes($bytes)); |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | \ No newline at end of file |
@@ -82,8 +82,8 @@ |
||
| 82 | 82 | } |
| 83 | 83 | if ($cypherKey->save() === true) { |
| 84 | 84 | $this->stdout('Key created :'."\n"); |
| 85 | - $this->stdout(' - id: ' . $cypherKey->id . "\n"); |
|
| 86 | - $this->stdout(' - Algorithm: ' . $cypherKey->encryptionAlgorithm . "\n"); |
|
| 85 | + $this->stdout(' - id: '.$cypherKey->id."\n"); |
|
| 86 | + $this->stdout(' - Algorithm: '.$cypherKey->encryptionAlgorithm."\n"); |
|
| 87 | 87 | } else { |
| 88 | 88 | $this->stdout('Key cannot be created.'."\n"); |
| 89 | 89 | } |
@@ -60,9 +60,9 @@ |
||
| 60 | 60 | $scope->definition = $this->definition; |
| 61 | 61 | if ($scope->save() === true) { |
| 62 | 62 | $this->stdout('Scope created :'."\n"); |
| 63 | - $this->stdout(' - id: ' . $scope->id . "\n"); |
|
| 64 | - $this->stdout(' - isDefault: ' . ($scope->isDefault ? 'Yes' : 'No') . "\n"); |
|
| 65 | - $this->stdout(' - definition: ' . $scope->definition . "\n"); |
|
| 63 | + $this->stdout(' - id: '.$scope->id."\n"); |
|
| 64 | + $this->stdout(' - isDefault: '.($scope->isDefault ? 'Yes' : 'No')."\n"); |
|
| 65 | + $this->stdout(' - definition: '.$scope->definition."\n"); |
|
| 66 | 66 | } else { |
| 67 | 67 | $this->stdout('Scope cannot be created.'."\n"); |
| 68 | 68 | } |