Passed
Push — master ( 77392d...e0a3bd )
by Kirill
08:16 queued 11s
created
src/AuthHttp/src/Middleware/AuthMiddleware.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         ActorProviderInterface $actorProvider,
55 55
         TokenStorageInterface $tokenStorage,
56 56
         TransportRegistry $transportRegistry
57
-    ) {
57
+    ){
58 58
         $this->scope = $scope;
59 59
         $this->actorProvider = $actorProvider;
60 60
         $this->tokenStorage = $tokenStorage;
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
      */
90 90
     private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface
91 91
     {
92
-        foreach ($this->transportRegistry->getTransports() as $name => $transport) {
92
+        foreach ($this->transportRegistry->getTransports() as $name => $transport){
93 93
             $tokenID = $transport->fetchToken($request);
94
-            if ($tokenID === null) {
94
+            if ($tokenID === null){
95 95
                 continue;
96 96
             }
97 97
 
98 98
             $token = $this->tokenStorage->load($tokenID);
99
-            if ($token === null) {
99
+            if ($token === null){
100 100
                 continue;
101 101
             }
102 102
 
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
      */
117 117
     private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response
118 118
     {
119
-        if ($authContext->getToken() === null) {
119
+        if ($authContext->getToken() === null){
120 120
             return $response;
121 121
         }
122 122
 
123 123
         $transport = $this->transportRegistry->getTransport($authContext->getTransport());
124 124
 
125
-        if ($authContext->isClosed()) {
125
+        if ($authContext->isClosed()){
126 126
             $this->tokenStorage->delete($authContext->getToken());
127 127
 
128 128
             return $transport->removeToken(
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,7 +74,8 @@  discard block
 block discarded – undo
74 74
 
75 75
         $response = $this->scope->runScope(
76 76
             [AuthContextInterface::class => $authContext],
77
-            static function () use ($request, $handler, $authContext) {
77
+            static function () use ($request, $handler, $authContext)
78
+            {
78 79
                 return $handler->handle($request->withAttribute(self::ATTRIBUTE, $authContext));
79 80
             }
80 81
         );
@@ -89,14 +90,17 @@  discard block
 block discarded – undo
89 90
      */
90 91
     private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface
91 92
     {
92
-        foreach ($this->transportRegistry->getTransports() as $name => $transport) {
93
+        foreach ($this->transportRegistry->getTransports() as $name => $transport)
94
+        {
93 95
             $tokenID = $transport->fetchToken($request);
94
-            if ($tokenID === null) {
96
+            if ($tokenID === null)
97
+            {
95 98
                 continue;
96 99
             }
97 100
 
98 101
             $token = $this->tokenStorage->load($tokenID);
99
-            if ($token === null) {
102
+            if ($token === null)
103
+            {
100 104
                 continue;
101 105
             }
102 106
 
@@ -116,13 +120,15 @@  discard block
 block discarded – undo
116 120
      */
117 121
     private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response
118 122
     {
119
-        if ($authContext->getToken() === null) {
123
+        if ($authContext->getToken() === null)
124
+        {
120 125
             return $response;
121 126
         }
122 127
 
123 128
         $transport = $this->transportRegistry->getTransport($authContext->getTransport());
124 129
 
125
-        if ($authContext->isClosed()) {
130
+        if ($authContext->isClosed())
131
+        {
126 132
             $this->tokenStorage->delete($authContext->getToken());
127 133
 
128 134
             return $transport->removeToken(
Please login to merge, or discard this patch.
src/AuthHttp/src/Middleware/Firewall/AbstractFirewall.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         /** @var AuthContextInterface $context */
34 34
         $authContext = $request->getAttribute(AuthMiddleware::ATTRIBUTE);
35 35
 
36
-        if ($authContext === null || $authContext->getActor() === null) {
36
+        if ($authContext === null || $authContext->getActor() === null){
37 37
             return $this->denyAccess($request, $handler);
38 38
         }
39 39
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
         /** @var AuthContextInterface $context */
34 34
         $authContext = $request->getAttribute(AuthMiddleware::ATTRIBUTE);
35 35
 
36
-        if ($authContext === null || $authContext->getActor() === null) {
36
+        if ($authContext === null || $authContext->getActor() === null)
37
+        {
37 38
             return $this->denyAccess($request, $handler);
38 39
         }
39 40
 
Please login to merge, or discard this patch.
src/AuthHttp/src/TransportRegistry.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     {
50 50
         $name = $name ?? $this->default;
51 51
 
52
-        if (!isset($this->transports[$name])) {
52
+        if (!isset($this->transports[$name])){
53 53
             throw new TransportException("Undefined auth transport {$name}");
54 54
         }
55 55
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,8 @@
 block discarded – undo
49 49
     {
50 50
         $name = $name ?? $this->default;
51 51
 
52
-        if (!isset($this->transports[$name])) {
52
+        if (!isset($this->transports[$name]))
53
+        {
53 54
             throw new TransportException("Undefined auth transport {$name}");
54 55
         }
55 56
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/AuthMiddlewareTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 
76 76
         $http->setHandler(
77 77
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
78
-                if ($request->getAttribute('authContext')->getToken() === null) {
78
+                if ($request->getAttribute('authContext')->getToken() === null){
79 79
                     echo 'no token';
80 80
                 }
81 81
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,8 @@
 block discarded – undo
75 75
 
76 76
         $http->setHandler(
77 77
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
78
-                if ($request->getAttribute('authContext')->getToken() === null) {
78
+                if ($request->getAttribute('authContext')->getToken() === null)
79
+                {
79 80
                     echo 'no token';
80 81
                 }
81 82
             }
Please login to merge, or discard this patch.
src/AuthHttp/tests/Diactoros/ResponseFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value){
41 41
             $response = $response->withAddedHeader($header, $value);
42 42
         }
43 43
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value)
41
+        {
41 42
             $response = $response->withAddedHeader($header, $value);
42 43
         }
43 44
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/Diactoros/UploadedFileFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         string $clientFilename = null,
27 27
         string $clientMediaType = null
28 28
     ): UploadedFileInterface {
29
-        if ($size === null) {
29
+        if ($size === null){
30 30
             $size = $stream->getSize();
31 31
         }
32 32
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@
 block discarded – undo
26 26
         string $clientFilename = null,
27 27
         string $clientMediaType = null
28 28
     ): UploadedFileInterface {
29
-        if ($size === null) {
29
+        if ($size === null)
30
+        {
30 31
             $size = $stream->getSize();
31 32
         }
32 33
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/CookieTransportTest.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
         $http->setHandler(
46 46
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
47
-                if ($request->getAttribute('authContext')->getToken() === null) {
47
+                if ($request->getAttribute('authContext')->getToken() === null){
48 48
                     echo 'no token';
49
-                } else {
49
+                }else{
50 50
                     echo $request->getAttribute('authContext')->getToken()->getID();
51 51
                     echo ':';
52 52
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 
77 77
         $http->setHandler(
78 78
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
79
-                if ($request->getAttribute('authContext')->getToken() === null) {
79
+                if ($request->getAttribute('authContext')->getToken() === null){
80 80
                     echo 'no token';
81
-                } else {
81
+                }else{
82 82
                     echo $request->getAttribute('authContext')->getToken()->getID();
83 83
                     echo ':';
84 84
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         );
192 192
 
193 193
         self::assertSame(
194
-            'Expires=' . gmdate(DATE_COOKIE, time() + 3600),
194
+            'Expires='.gmdate(DATE_COOKIE, time() + 3600),
195 195
             $cookie[1]
196 196
         );
197 197
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,9 +43,12 @@  discard block
 block discarded – undo
43 43
 
44 44
         $http->setHandler(
45 45
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
46
-                if ($request->getAttribute('authContext')->getToken() === null) {
46
+                if ($request->getAttribute('authContext')->getToken() === null)
47
+                {
47 48
                     echo 'no token';
48
-                } else {
49
+                }
50
+                else
51
+                {
49 52
                     echo $request->getAttribute('authContext')->getToken()->getID();
50 53
                     echo ':';
51 54
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
@@ -67,9 +70,12 @@  discard block
 block discarded – undo
67 70
 
68 71
         $http->setHandler(
69 72
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
70
-                if ($request->getAttribute('authContext')->getToken() === null) {
73
+                if ($request->getAttribute('authContext')->getToken() === null)
74
+                {
71 75
                     echo 'no token';
72
-                } else {
76
+                }
77
+                else
78
+                {
73 79
                     echo $request->getAttribute('authContext')->getToken()->getID();
74 80
                     echo ':';
75 81
                     echo json_encode($request->getAttribute('authContext')->getToken()->getPayload());
Please login to merge, or discard this patch.
src/Auth/tests/Stub/TestAuthProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 {
19 19
     public function getActor(TokenInterface $token): ?object
20 20
     {
21
-        if ($token->getPayload()['ok']) {
21
+        if ($token->getPayload()['ok']){
22 22
             return new \stdClass();
23 23
         }
24 24
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
 {
19 19
     public function getActor(TokenInterface $token): ?object
20 20
     {
21
-        if ($token->getPayload()['ok']) {
21
+        if ($token->getPayload()['ok'])
22
+        {
22 23
             return new \stdClass();
23 24
         }
24 25
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/Stub/TestAuthHttpProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 {
19 19
     public function getActor(TokenInterface $token): ?object
20 20
     {
21
-        if ($token->getID() === 'ok') {
21
+        if ($token->getID() === 'ok'){
22 22
             return new \stdClass();
23 23
         }
24 24
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
 {
19 19
     public function getActor(TokenInterface $token): ?object
20 20
     {
21
-        if ($token->getID() === 'ok') {
21
+        if ($token->getID() === 'ok')
22
+        {
22 23
             return new \stdClass();
23 24
         }
24 25
 
Please login to merge, or discard this patch.