Completed
Push — devel ( 13d8c8...c27311 )
by Philippe
10s
created
src/services/Oauth.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,38 +44,38 @@
 block discarded – undo
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;
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.
src/commands/KeyController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/commands/JwtController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.