Passed
Push — master ( fd01cd...a8d522 )
by Alexandre
02:26
created
src/OAuth2OLD/EndpointMessages/Authorization/ErrorResponse.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,18 +37,18 @@  discard block
 block discarded – undo
37 37
                                 ?string $errorUri = null, ?string $state = null)
38 38
     {
39 39
         if ($this->containsNotAsciiChar($error)) {
40
-            throw new \Exception('Malformed error type. Expect ascii string. Got : ' . $error);
40
+            throw new \Exception('Malformed error type. Expect ascii string. Got : '.$error);
41 41
         }
42 42
 
43 43
         if (!in_array($error, self::errors)) {
44
-            throw new \Exception('Unexpected error type. Expect one of : ' . implode(', ', self::errors));
44
+            throw new \Exception('Unexpected error type. Expect one of : '.implode(', ', self::errors));
45 45
         }
46 46
 
47 47
         $redirectUri = Uri::withQueryValue($redirectUri, 'error', $error);
48 48
 
49 49
         if ($errorDescription) {
50 50
             if ($this->containsNotAsciiChar($errorDescription)) {
51
-                throw new \Exception('Malformed error description. Expect ascii string. Got : ' . $errorDescription);
51
+                throw new \Exception('Malformed error description. Expect ascii string. Got : '.$errorDescription);
52 52
             }
53 53
 
54 54
             $redirectUri = Uri::withQueryValue($redirectUri, 'error_description', $errorDescription);
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 
57 57
         if ($errorUri) {
58 58
             if ($this->containsNotAsciiChar($errorUri)) {
59
-                throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $errorUri);
59
+                throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$errorUri);
60 60
             }
61 61
 
62 62
             $redirectUri = Uri::withQueryValue($redirectUri, 'error_uri', $errorUri);
63 63
         }
64 64
 
65
-        if($state) {
65
+        if ($state) {
66 66
             $redirectUri = Uri::withQueryValue($redirectUri, 'state', $state);
67 67
         }
68 68
 
Please login to merge, or discard this patch.
src/OAuth2OLD/EndpointMessages/Token/AccessTokenRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,10 +94,10 @@
 block discarded – undo
94 94
      */
95 95
     static public function createFromServerRequest(ServerRequestInterface $request)
96 96
     {
97
-        if(!isset($request->getParsedBody()['grant_type'])) {
97
+        if (!isset($request->getParsedBody()['grant_type'])) {
98 98
             throw new \Exception('Missing a required parameter : grant_type');
99 99
         }
100
-        if(!isset($request->getParsedBody()['code'])) {
100
+        if (!isset($request->getParsedBody()['code'])) {
101 101
             throw new \Exception('Missing a required parameter : code');
102 102
         }
103 103
 
Please login to merge, or discard this patch.
src/OAuth2OLD/EndpointMessages/Token/ErrorResponse.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,25 +37,25 @@
 block discarded – undo
37 37
     public function __construct(string $error, ?string $errorDescription = null, ?string $errorUri = null, int $status = 400, array $headers = [])
38 38
     {
39 39
         if ($this->containsNotAsciiChar($error)) {
40
-            throw new \Exception('Malformed error type. Expect ascii string. Got : ' . $error);
40
+            throw new \Exception('Malformed error type. Expect ascii string. Got : '.$error);
41 41
         }
42 42
 
43 43
         if (!in_array($error, self::errors)) {
44
-            throw new \Exception('Unexpected error type. Expect one of : ' . implode(', ', self::errors));
44
+            throw new \Exception('Unexpected error type. Expect one of : '.implode(', ', self::errors));
45 45
         }
46 46
 
47 47
         $data = ['error' => $error];
48 48
 
49 49
         if ($errorDescription) {
50 50
             if ($this->containsNotAsciiChar($errorDescription)) {
51
-                throw new \Exception('Malformed error description. Expect ascii string. Got : ' . $errorDescription);
51
+                throw new \Exception('Malformed error description. Expect ascii string. Got : '.$errorDescription);
52 52
             }
53 53
             $data['error_description'] = $errorDescription;
54 54
         }
55 55
 
56 56
         if ($errorUri) {
57 57
             if ($this->containsNotAsciiChar($errorUri)) {
58
-                throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $errorUri);
58
+                throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$errorUri);
59 59
             }
60 60
 
61 61
             $data['error_uri'] = $errorUri;
Please login to merge, or discard this patch.
src/OAuth2OLD/ResponseTypes/CodeResponseType.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      * @throws OAuthException
45 45
      */
46 46
     public function handle(ServerRequestInterface $request, ResourceOwnerInterface $resourceOwner,
47
-                           RegisteredClient $client, ?array $scope = null, ?array $extendedResponseTypes = null): array
47
+                            RegisteredClient $client, ?array $scope = null, ?array $extendedResponseTypes = null): array
48 48
     {
49 49
         if (is_array($client->getSupportedGrantTypes()) && !in_array('authorization_code', $client->getSupportedGrantTypes())) {
50 50
             throw new OAuthException('unauthorized_client',
Please login to merge, or discard this patch.
src/OAuth2OLD/ResponseTypes/ResponseTypeInterface.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      * @return array
29 29
      */
30 30
     public function handle(ServerRequestInterface $request, ResourceOwnerInterface $resourceOwner,
31
-                           RegisteredClient $client, ?array $scope = null, ?array $extendedResponseTypes = null): array;
31
+                            RegisteredClient $client, ?array $scope = null, ?array $extendedResponseTypes = null): array;
32 32
 
33 33
     public function getDefaultResponseMode(): string;
34 34
     public function isQueryResponseModeSupported(): bool;
Please login to merge, or discard this patch.
src/OAuth2OLD/ScopePolicy/Policies/ScopePolicyInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,5 +14,5 @@
 block discarded – undo
14 14
 interface ScopePolicyInterface
15 15
 {
16 16
 //    function check(array $scope, ClientInterface $client): bool ;
17
-    function getDefaultScopes(ClientInterface $client) : ?array ;
17
+    function getDefaultScopes(ClientInterface $client) : ?array;
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
src/OAuth2OLD/Endpoints/TokenEndpoint.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $grantType = $this->server->getGrantTypeRepository()->getGrantType($grantTypeName);
37 37
         if (!$grantType) {
38 38
             return new ErrorResponse('unsupported_grant_type',
39
-                'Unsupported grant type : ' . $grantTypeName,
39
+                'Unsupported grant type : '.$grantTypeName,
40 40
                 'https://tools.ietf.org/html/rfc6749#section-5.2');
41 41
         }
42 42
 
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
         } catch (OAuthException $e) {
55 55
             if ($e->getError() == 'invalid_client' && $request->hasHeader('Authorization')) {
56 56
                 return new ErrorResponse($e->getError(),
57
-                    'Client authentication failed : ' . $e->getMessage(),
57
+                    'Client authentication failed : '.$e->getMessage(),
58 58
                     $e->getErrorUri(), 401, [
59 59
                         'WWW-Authenticate' => 'Basic'
60 60
                     ]);
61 61
             } else {
62 62
                 return new ErrorResponse($e->getError(),
63
-                    'Client authentication failed : ' . $e->getMessage(),
63
+                    'Client authentication failed : '.$e->getMessage(),
64 64
                     $e->getErrorUri(), 401);
65 65
             }
66 66
         }
67 67
 
68
-        if(!$client) {
68
+        if (!$client) {
69 69
             if (!isset($request->getParsedBody()['client_id'])) {
70 70
                 return new ErrorResponse('invalid_request',
71 71
                     'Client authentication not included, missing a parameter : client_id : ',
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
             if ($client->hasCredentials()) {
83 83
                 return new ErrorResponse('invalid_client',
84
-                    'Client authentication failed : ' . $guard->getError(),
84
+                    'Client authentication failed : '.$guard->getError(),
85 85
                     'https://tools.ietf.org/html/rfc6749#section-5.2', 401, [
86 86
                         'WWW-Authenticate' => 'Basic'
87 87
                     ]);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
         if (is_array($client->getSupportedGrantTypes()) && !in_array($grantType->getUri(), $client->getSupportedGrantTypes())) {
92 92
             return new ErrorResponse('unauthorized_client',
93
-                'Unauthorized grant type : ' . $grantType->getUri(),
93
+                'Unauthorized grant type : '.$grantType->getUri(),
94 94
                 'https://tools.ietf.org/html/rfc6749#section-5.2');
95 95
         }
96 96
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,8 +96,7 @@
 block discarded – undo
96 96
 
97 97
         try {
98 98
             return $grantType->grant($request, $client);
99
-        }
100
-        catch (OAuthException $e) {
99
+        } catch (OAuthException $e) {
101 100
             return new ErrorResponse($e->getError(),
102 101
                 $e->getErrorDescription(),
103 102
                 $e->getErrorUri());
Please login to merge, or discard this patch.
src/OAuth2OLD/Endpoints/AuthorizationEndpoint.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@
 block discarded – undo
221 221
             if (!$scopePolicyManager->checkScope($client, $scope)) {
222 222
                 $supportedScopes = implode(', ', $scopePolicyManager->getSupportedScopes($client));
223 223
                 throw new OAuthException('invalid_scope',
224
-                    'Some of requested scopes are not supported. Scope supported : ' . $supportedScopes,
224
+                    'Some of requested scopes are not supported. Scope supported : '.$supportedScopes,
225 225
                     'https://tools.ietf.org/html/rfc6749#section-4.1');
226 226
             }
227 227
 
Please login to merge, or discard this patch.
src/OAuth2OLD/OpenID/ResponseTypes/NoneResponseType.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @return array
31 31
      */
32 32
     public function handle(ServerRequestInterface $request, ResourceOwnerInterface $resourceOwner,
33
-                           RegisteredClient $client, ?array $scope = null, ?array $extendedResponseTypes = null): array
33
+                            RegisteredClient $client, ?array $scope = null, ?array $extendedResponseTypes = null): array
34 34
     {
35 35
         return [];
36 36
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function getExtendedResponseTypes(): ?array
65 65
     {
66
-       return null;
66
+        return null;
67 67
     }
68 68
 
69 69
     public function isQueryResponseModeSupported(): bool
Please login to merge, or discard this patch.