@@ -233,7 +233,7 @@ |
||
| 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 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | protected 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 |
||
| 62 | 62 | */ |
| 63 | 63 | protected 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 |
||
| 71 | 71 | */ |
| 72 | 72 | protected 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 |
||
| 79 | 79 | */ |
| 80 | 80 | protected 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 |
||
| 87 | 87 | */ |
| 88 | 88 | protected 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 |
||
| 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 |
||
| 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 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected 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 |
||
| 65 | 65 | */ |
| 66 | 66 | protected 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 |
||
| 75 | 75 | */ |
| 76 | 76 | protected 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 |
||
| 83 | 83 | */ |
| 84 | 84 | protected 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 |
||
| 91 | 91 | */ |
| 92 | 92 | protected 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 |
||
| 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 |
||
| 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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected 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 |
||
| 60 | 60 | */ |
| 61 | 61 | protected 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 |
||
| 70 | 70 | */ |
| 71 | 71 | protected 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 |
||
| 78 | 78 | */ |
| 79 | 79 | protected 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 |
||
| 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 |
||
| 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 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected 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 |
||
| 65 | 65 | */ |
| 66 | 66 | protected 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 |
||
| 75 | 75 | */ |
| 76 | 76 | protected 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 |
||
| 83 | 83 | */ |
| 84 | 84 | protected 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 |
||
| 91 | 91 | */ |
| 92 | 92 | protected 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 |
||
| 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 |
||
| 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 | } |
@@ -44,38 +44,38 @@ |
||
| 44 | 44 | public static function register($app) |
| 45 | 45 | { |
| 46 | 46 | $module = Module::getInstance(); |
| 47 | - Yii::$container->set('OAuth2\Server', function ($container, $params, $config) use ($module) { |
|
| 47 | + Yii::$container->set('OAuth2\Server', function($container, $params, $config) use ($module) { |
|
| 48 | 48 | $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage'); |
| 49 | 49 | $server = new Server($storage, self::prepareServerConfig($config, $module)); |
| 50 | 50 | return $server; |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | - Yii::$container->set('OAuth2\GrantType\AuthorizationCode', function ($container, $params, $config) { |
|
| 53 | + Yii::$container->set('OAuth2\GrantType\AuthorizationCode', function($container, $params, $config) { |
|
| 54 | 54 | $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage'); |
| 55 | 55 | $grantType = new AuthorizationCode($storage); |
| 56 | 56 | return $grantType; |
| 57 | 57 | }); |
| 58 | 58 | |
| 59 | - Yii::$container->set('OAuth2\GrantType\ClientCredentials', function ($container, $params, $config) use ($module) { |
|
| 59 | + Yii::$container->set('OAuth2\GrantType\ClientCredentials', function($container, $params, $config) use ($module) { |
|
| 60 | 60 | $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage'); |
| 61 | 61 | $grantType = new ClientCredentials($storage, self::prepareServerConfig($config, $module)); |
| 62 | 62 | return $grantType; |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | - Yii::$container->set('OAuth2\GrantType\JwtBearer', function ($container, $params, $config) use ($module) { |
|
| 65 | + Yii::$container->set('OAuth2\GrantType\JwtBearer', function($container, $params, $config) use ($module) { |
|
| 66 | 66 | $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage'); |
| 67 | 67 | $audience = Url::to($module->jwtAudience, true); |
| 68 | 68 | $grantType = new JwtBearer($storage, $audience, null, self::prepareServerConfig($config, $module)); |
| 69 | 69 | return $grantType; |
| 70 | 70 | }); |
| 71 | 71 | |
| 72 | - Yii::$container->set('OAuth2\GrantType\RefreshToken', function ($container, $params, $config) use ($module) { |
|
| 72 | + Yii::$container->set('OAuth2\GrantType\RefreshToken', function($container, $params, $config) use ($module) { |
|
| 73 | 73 | $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage'); |
| 74 | 74 | $grantType = new RefreshToken($storage, self::prepareServerConfig($config, $module)); |
| 75 | 75 | return $grantType; |
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | - Yii::$container->set('OAuth2\GrantType\UserCredentials', function ($container, $params, $config) { |
|
| 78 | + Yii::$container->set('OAuth2\GrantType\UserCredentials', function($container, $params, $config) { |
|
| 79 | 79 | $storage = Yii::createObject('sweelix\oauth2\server\storage\OauthStorage'); |
| 80 | 80 | $grantType = new UserCredentials($storage); |
| 81 | 81 | return $grantType; |
@@ -63,13 +63,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |