@@ -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 | } |
@@ -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 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | $cypherKey->generateKeys(); |
| 85 | 85 | } |
| 86 | 86 | if ($cypherKey->save() === true) { |
| 87 | - $this->stdout('Key created :' . "\n"); |
|
| 88 | - $this->stdout(' - id: ' . $cypherKey->id . "\n"); |
|
| 89 | - $this->stdout(' - Algorithm: ' . $cypherKey->encryptionAlgorithm . "\n"); |
|
| 87 | + $this->stdout('Key created :'."\n"); |
|
| 88 | + $this->stdout(' - id: '.$cypherKey->id."\n"); |
|
| 89 | + $this->stdout(' - Algorithm: '.$cypherKey->encryptionAlgorithm."\n"); |
|
| 90 | 90 | return ExitCode::OK; |
| 91 | 91 | } else { |
| 92 | - $this->stdout('Key cannot be created.' . "\n"); |
|
| 92 | + $this->stdout('Key cannot be created.'."\n"); |
|
| 93 | 93 | return ExitCode::UNSPECIFIED_ERROR; |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | $cypherKey->generateKeys(); |
| 123 | 123 | } |
| 124 | 124 | if ($cypherKey->save() === true) { |
| 125 | - $this->stdout('Key updated :' . "\n"); |
|
| 126 | - $this->stdout(' - id: ' . $cypherKey->id . "\n"); |
|
| 127 | - $this->stdout(' - Algorithm: ' . $cypherKey->encryptionAlgorithm . "\n"); |
|
| 125 | + $this->stdout('Key updated :'."\n"); |
|
| 126 | + $this->stdout(' - id: '.$cypherKey->id."\n"); |
|
| 127 | + $this->stdout(' - Algorithm: '.$cypherKey->encryptionAlgorithm."\n"); |
|
| 128 | 128 | return ExitCode::OK; |
| 129 | 129 | } else { |
| 130 | - $this->stdout('Key ' . $id . ' cannot be updated' . "\n"); |
|
| 130 | + $this->stdout('Key '.$id.' cannot be updated'."\n"); |
|
| 131 | 131 | return ExitCode::UNSPECIFIED_ERROR; |
| 132 | 132 | } |
| 133 | 133 | } else { |
| 134 | - $this->stdout('Key ' . $id . ' does not exist' . "\n"); |
|
| 134 | + $this->stdout('Key '.$id.' does not exist'."\n"); |
|
| 135 | 135 | return ExitCode::UNSPECIFIED_ERROR; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | $cypherKey = $cypherKeyClass::findOne($id); |
| 152 | 152 | if ($cypherKey !== null) { |
| 153 | 153 | if ($cypherKey->delete() === true) { |
| 154 | - $this->stdout('Key ' . $id . ' deleted' . "\n"); |
|
| 154 | + $this->stdout('Key '.$id.' deleted'."\n"); |
|
| 155 | 155 | return ExitCode::OK; |
| 156 | 156 | } else { |
| 157 | - $this->stdout('Key ' . $id . ' cannot be deleted' . "\n"); |
|
| 157 | + $this->stdout('Key '.$id.' cannot be deleted'."\n"); |
|
| 158 | 158 | return ExitCode::UNSPECIFIED_ERROR; |
| 159 | 159 | } |
| 160 | 160 | } else { |
| 161 | - $this->stdout('Key ' . $id . ' does not exist' . "\n"); |
|
| 161 | + $this->stdout('Key '.$id.' does not exist'."\n"); |
|
| 162 | 162 | return ExitCode::UNSPECIFIED_ERROR; |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -76,14 +76,14 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |