Test Failed
Push — develop ( a061b1...df8064 )
by nguereza
02:52
created
src/OAuth2/Repository/ScopeRepository.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,8 @@
 block discarded – undo
93 93
     public function getDefaultScopes(): array
94 94
     {
95 95
         $result = $this->query()
96
-                       ->where('is_default')->is(1)
97
-                       ->all();
96
+                        ->where('is_default')->is(1)
97
+                        ->all();
98 98
         $scopes = [];
99 99
         foreach ($result as $row) {
100 100
             $scopes[] = Scope::createNewScope(
Please login to merge, or discard this patch.
Braces   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,14 +58,12 @@  discard block
 block discarded – undo
58 58
  * @package Platine\Framework\OAuth2\Repository
59 59
  * @extends Repository<OauthScope>
60 60
  */
61
-class ScopeRepository extends Repository implements ScopeRepositoryInterface
62
-{
61
+class ScopeRepository extends Repository implements ScopeRepositoryInterface {
63 62
     /**
64 63
      * Create new instance
65 64
      * @param EntityManager<OauthScope> $manager
66 65
      */
67
-    public function __construct(EntityManager $manager)
68
-    {
66
+    public function __construct(EntityManager $manager) {
69 67
         parent::__construct($manager, OauthScope::class);
70 68
     }
71 69
 
@@ -76,7 +74,7 @@  discard block
 block discarded – undo
76 74
     {
77 75
         $result = $this->all();
78 76
         $scopes = [];
79
-        foreach ($result as $row) {
77
+        foreach ($result as $row) {
80 78
             $scopes[] = Scope::createNewScope(
81 79
                 $row->id,
82 80
                 $row->name,
@@ -96,7 +94,7 @@  discard block
 block discarded – undo
96 94
                        ->where('is_default')->is(1)
97 95
                        ->all();
98 96
         $scopes = [];
99
-        foreach ($result as $row) {
97
+        foreach ($result as $row) {
100 98
             $scopes[] = Scope::createNewScope(
101 99
                 $row->id,
102 100
                 $row->name,
Please login to merge, or discard this patch.
src/OAuth2/Repository/AuthorizationCodeRepository.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function cleanExpiredTokens(): void
87 87
     {
88 88
         $this->query()->where('expires')->lte(date('Y-m-d H:i:s'))
89
-                      ->delete();
89
+                        ->delete();
90 90
     }
91 91
 
92 92
     /**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     public function deleteToken(BaseToken $token): bool
96 96
     {
97 97
         return $this->query()->where('authorization_code')->is($token->getToken())
98
-                             ->delete() >= 0;
98
+                                ->delete() >= 0;
99 99
     }
100 100
 
101 101
     /**
Please login to merge, or discard this patch.
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
  * @package Platine\Framework\OAuth2\Repository
62 62
  * @extends Repository<OauthAuthorizationCode>
63 63
  */
64
-class AuthorizationCodeRepository extends Repository implements AuthorizationCodeRepositoryInterface
65
-{
64
+class AuthorizationCodeRepository extends Repository implements AuthorizationCodeRepositoryInterface {
66 65
     /**
67 66
      * The Client Service
68 67
      * @var ClientService
@@ -74,8 +73,7 @@  discard block
 block discarded – undo
74 73
      * @param EntityManager<OauthAuthorizationCode> $manager
75 74
      * @param ClientService $clientService
76 75
      */
77
-    public function __construct(EntityManager $manager, ClientService $clientService)
78
-    {
76
+    public function __construct(EntityManager $manager, ClientService $clientService) {
79 77
         parent::__construct($manager, OauthAuthorizationCode::class);
80 78
         $this->clientService = $clientService;
81 79
     }
@@ -104,12 +102,12 @@  discard block
 block discarded – undo
104 102
     public function getByToken(string $token): ?BaseToken
105 103
     {
106 104
         $code = $this->find($token);
107
-        if ($code === null) {
105
+        if ($code === null) {
108 106
             return null;
109 107
         }
110 108
 
111 109
         $client = null;
112
-        if ($code->client_id !== null) {
110
+        if ($code->client_id !== null) {
113 111
             $client = $this->clientService->find($code->client_id);
114 112
         }
115 113
 
@@ -137,12 +135,12 @@  discard block
 block discarded – undo
137 135
     public function saveCode(AuthorizationCode $token): AuthorizationCode
138 136
     {
139 137
         $clientId = null;
140
-        if ($token->getClient() !== null) {
138
+        if ($token->getClient() !== null) {
141 139
             $clientId = $token->getClient()->getId();
142 140
         }
143 141
 
144 142
         $ownerId = null;
145
-        if ($token->getOwner() !== null) {
143
+        if ($token->getOwner() !== null) {
146 144
             $ownerId = $token->getOwner()->getOwnerId();
147 145
         }
148 146
 
Please login to merge, or discard this patch.
src/OAuth2/Repository/AccessTokenRepository.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     public function cleanExpiredTokens(): void
87 87
     {
88 88
         $this->query()->where('expires')->lte(date('Y-m-d H:i:s'))
89
-                      ->delete();
89
+                        ->delete();
90 90
     }
91 91
 
92 92
     /**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     public function deleteToken(BaseToken $token): bool
96 96
     {
97 97
         return $this->query()->where('access_token')->is($token->getToken())
98
-                             ->delete() >= 0;
98
+                                ->delete() >= 0;
99 99
     }
100 100
 
101 101
     /**
Please login to merge, or discard this patch.
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
  * @package Platine\Framework\OAuth2\Repository
62 62
  * @extends Repository<OauthAccessToken>
63 63
  */
64
-class AccessTokenRepository extends Repository implements AccessTokenRepositoryInterface
65
-{
64
+class AccessTokenRepository extends Repository implements AccessTokenRepositoryInterface {
66 65
     /**
67 66
      * The Client Service
68 67
      * @var ClientService
@@ -74,8 +73,7 @@  discard block
 block discarded – undo
74 73
      * @param EntityManager<OauthAccessToken> $manager
75 74
      * @param ClientService $clientService
76 75
      */
77
-    public function __construct(EntityManager $manager, ClientService $clientService)
78
-    {
76
+    public function __construct(EntityManager $manager, ClientService $clientService) {
79 77
         parent::__construct($manager, OauthAccessToken::class);
80 78
         $this->clientService = $clientService;
81 79
     }
@@ -104,12 +102,12 @@  discard block
 block discarded – undo
104 102
     public function getByToken(string $token): ?BaseToken
105 103
     {
106 104
         $accessToken = $this->find($token);
107
-        if ($accessToken === null) {
105
+        if ($accessToken === null) {
108 106
             return null;
109 107
         }
110 108
 
111 109
         $client = null;
112
-        if ($accessToken->client_id !== null) {
110
+        if ($accessToken->client_id !== null) {
113 111
             $client = $this->clientService->find($accessToken->client_id);
114 112
         }
115 113
 
@@ -136,12 +134,12 @@  discard block
 block discarded – undo
136 134
     public function saveAccessToken(AccessToken $token): AccessToken
137 135
     {
138 136
         $clientId = null;
139
-        if ($token->getClient() !== null) {
137
+        if ($token->getClient() !== null) {
140 138
             $clientId = $token->getClient()->getId();
141 139
         }
142 140
 
143 141
         $ownerId = null;
144
-        if ($token->getOwner() !== null) {
142
+        if ($token->getOwner() !== null) {
145 143
             $ownerId = $token->getOwner()->getOwnerId();
146 144
         }
147 145
 
Please login to merge, or discard this patch.
src/OAuth2/Entity/OauthAccessToken.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
      */
22 22
     public static function mapEntity(EntityMapperInterface $mapper): void
23 23
     {
24
-         $mapper->primaryKey('access_token');
25
-         $mapper->useTimestamp();
26
-         $mapper->casts([
24
+            $mapper->primaryKey('access_token');
25
+            $mapper->useTimestamp();
26
+            $mapper->casts([
27 27
             'expires' => 'date',
28 28
             'created_at' => 'date',
29 29
             'updated_at' => '?date',
30
-         ]);
30
+            ]);
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 * @package Platine\Framework\OAuth2\Entity
13 13
 * @extends Entity<OauthAccessToken>
14 14
 */
15
-class OauthAccessToken extends Entity
16
-{
15
+class OauthAccessToken extends Entity {
17 16
     /**
18 17
      *
19 18
      * @param EntityMapperInterface<OauthAccessToken> $mapper
Please login to merge, or discard this patch.
src/OAuth2/Entity/OauthRefreshToken.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
20 20
      */
21 21
     public static function mapEntity(EntityMapperInterface $mapper): void
22 22
     {
23
-         $mapper->primaryKey('refresh_token');
24
-         $mapper->useTimestamp();
25
-         $mapper->casts([
23
+            $mapper->primaryKey('refresh_token');
24
+            $mapper->useTimestamp();
25
+            $mapper->casts([
26 26
             'expires' => 'date',
27 27
             'created_at' => 'date',
28 28
             'updated_at' => '?date',
29
-         ]);
29
+            ]);
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 * @package Platine\Framework\OAuth2\Entity
13 13
 * @extends Entity<OauthRefreshToken>
14 14
 */
15
-class OauthRefreshToken extends Entity
16
-{
15
+class OauthRefreshToken extends Entity {
17 16
     /**
18 17
      * @param EntityMapperInterface<OauthRefreshToken> $mapper
19 18
      * @return void
Please login to merge, or discard this patch.
src/OAuth2/Entity/OauthClient.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
      */
22 22
     public static function mapEntity(EntityMapperInterface $mapper): void
23 23
     {
24
-         $mapper->useTimestamp();
25
-         $mapper->casts([
24
+            $mapper->useTimestamp();
25
+            $mapper->casts([
26 26
             'created_at' => 'date',
27 27
             'updated_at' => '?date',
28
-         ]);
28
+            ]);
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 * @package Platine\Framework\OAuth2\Entity
13 13
 * @extends Entity<OauthClient>
14 14
 */
15
-class OauthClient extends Entity
16
-{
15
+class OauthClient extends Entity {
17 16
     /**
18 17
      *
19 18
      * @param EntityMapperInterface<OauthClient> $mapper
Please login to merge, or discard this patch.
src/OAuth2/Entity/OauthScope.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
      */
22 22
     public static function mapEntity(EntityMapperInterface $mapper): void
23 23
     {
24
-         $mapper->useTimestamp();
25
-         $mapper->casts([
24
+            $mapper->useTimestamp();
25
+            $mapper->casts([
26 26
             'created_at' => 'date',
27 27
             'updated_at' => '?date',
28
-         ]);
28
+            ]);
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 * @package Platine\Framework\OAuth2\Entity
13 13
 * @extends Entity<OauthScope>
14 14
 */
15
-class OauthScope extends Entity
16
-{
15
+class OauthScope extends Entity {
17 16
     /**
18 17
      *
19 18
      * @param EntityMapperInterface<OauthScope> $mapper
Please login to merge, or discard this patch.
src/OAuth2/Entity/OauthAuthorizationCode.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
      */
22 22
     public static function mapEntity(EntityMapperInterface $mapper): void
23 23
     {
24
-         $mapper->primaryKey('authorization_code');
25
-         $mapper->useTimestamp();
26
-         $mapper->casts([
24
+            $mapper->primaryKey('authorization_code');
25
+            $mapper->useTimestamp();
26
+            $mapper->casts([
27 27
             'expires' => 'date',
28 28
             'created_at' => 'date',
29 29
             'updated_at' => '?date',
30
-         ]);
30
+            ]);
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 * @package Platine\Framework\OAuth2\Entity
13 13
 * @extends Entity<OauthAuthorizationCode>
14 14
 */
15
-class OauthAuthorizationCode extends Entity
16
-{
15
+class OauthAuthorizationCode extends Entity {
17 16
     /**
18 17
      *
19 18
      * @param EntityMapperInterface<OauthAuthorizationCode> $mapper
Please login to merge, or discard this patch.
src/Http/RequestData.php 1 patch
Braces   +12 added lines, -20 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * @class RequestData
55 55
  * @package Platine\Framework\Http
56 56
  */
57
-class RequestData
58
-{
57
+class RequestData {
59 58
     /**
60 59
      * The request body or post data
61 60
      * @var array<string, mixed>
@@ -96,8 +95,7 @@  discard block
 block discarded – undo
96 95
      * Create new instance
97 96
      * @param ServerRequestInterface $request
98 97
      */
99
-    public function __construct(ServerRequestInterface $request)
100
-    {
98
+    public function __construct(ServerRequestInterface $request) {
101 99
         $this->posts = (array) $request->getParsedBody();
102 100
         $this->gets = $request->getQueryParams();
103 101
         $this->servers = $request->getServerParams();
@@ -169,8 +167,7 @@  discard block
 block discarded – undo
169 167
      *
170 168
      * @return mixed
171 169
      */
172
-    public function get(string $key, $default = null)
173
-    {
170
+    public function get(string $key, $default = null) {
174 171
         $gets = $this->applyInputClean($this->gets);
175 172
         return Arr::get($gets, $key, $default);
176 173
     }
@@ -182,8 +179,7 @@  discard block
 block discarded – undo
182 179
      *
183 180
      * @return mixed
184 181
      */
185
-    public function post(string $key, $default = null)
186
-    {
182
+    public function post(string $key, $default = null) {
187 183
         $posts = $this->applyInputClean($this->posts);
188 184
         return Arr::get($posts, $key, $default);
189 185
     }
@@ -195,8 +191,7 @@  discard block
 block discarded – undo
195 191
      *
196 192
      * @return mixed
197 193
      */
198
-    public function server(string $key, $default = null)
199
-    {
194
+    public function server(string $key, $default = null) {
200 195
         $servers = $this->applyInputClean($this->servers);
201 196
         return Arr::get($servers, $key, $default);
202 197
     }
@@ -208,8 +203,7 @@  discard block
 block discarded – undo
208 203
      *
209 204
      * @return mixed
210 205
      */
211
-    public function cookie(string $key, $default = null)
212
-    {
206
+    public function cookie(string $key, $default = null) {
213 207
         $cookies = $this->applyInputClean($this->cookies);
214 208
         return Arr::get($cookies, $key, $default);
215 209
     }
@@ -220,8 +214,7 @@  discard block
 block discarded – undo
220 214
      *
221 215
      * @return mixed
222 216
      */
223
-    public function file(string $key)
224
-    {
217
+    public function file(string $key) {
225 218
         $files = $this->files;
226 219
         return Arr::get($files, $key, null);
227 220
     }
@@ -231,14 +224,13 @@  discard block
 block discarded – undo
231 224
      * @param mixed $str
232 225
      * @return mixed
233 226
      */
234
-    protected function cleanInput($str)
235
-    {
236
-        if (is_array($str)) {
227
+    protected function cleanInput($str) {
228
+        if (is_array($str)) {
237 229
             return array_map([$this, 'cleanInput'], $str);
238 230
         }
239
-        if (is_object($str)) {
231
+        if (is_object($str)) {
240 232
             $obj = $str;
241
-            foreach ($str as $var => $value) {
233
+            foreach ($str as $var => $value) {
242 234
                 $obj->{$var} = $this->cleanInput($value);
243 235
             }
244 236
             return $obj;
@@ -254,7 +246,7 @@  discard block
 block discarded – undo
254 246
      */
255 247
     protected function applyInputClean(array $data): array
256 248
     {
257
-        if ($this->autoEscape) {
249
+        if ($this->autoEscape) {
258 250
             $data = $this->cleanInput($data);
259 251
         }
260 252
 
Please login to merge, or discard this patch.