Passed
Push — master ( e8b00c...89139c )
by Anton
07:46
created
src/AuthHttp/src/Transport/CookieTransport.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         bool $secure = false,
57 57
         bool $httpOnly = true,
58 58
         ?string $sameSite = null
59
-    ) {
59
+    ){
60 60
         $this->cookie = $cookie;
61 61
         $this->basePath = $basePath;
62 62
         $this->domain = $domain;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     ): Response {
86 86
         /** @var CookieQueue $cookieQueue */
87 87
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
88
-        if ($cookieQueue === null) {
88
+        if ($cookieQueue === null){
89 89
             return $response->withAddedHeader(
90 90
                 'Set-Cookie',
91 91
                 Cookie::create(
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
             );
102 102
         }
103 103
 
104
-        if ($tokenID === null) {
104
+        if ($tokenID === null){
105 105
             $cookieQueue->delete($this->cookie);
106
-        } else {
106
+        }else{
107 107
             $cookieQueue->set(
108 108
                 $this->cookie,
109 109
                 $tokenID,
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     private function getLifetime(\DateTimeInterface $expiresAt = null): ?int
136 136
     {
137
-        if ($expiresAt === null) {
137
+        if ($expiresAt === null){
138 138
             return null;
139 139
         }
140 140
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,7 +85,8 @@  discard block
 block discarded – undo
85 85
     ): Response {
86 86
         /** @var CookieQueue $cookieQueue */
87 87
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
88
-        if ($cookieQueue === null) {
88
+        if ($cookieQueue === null)
89
+        {
89 90
             return $response->withAddedHeader(
90 91
                 'Set-Cookie',
91 92
                 Cookie::create(
@@ -101,9 +102,12 @@  discard block
 block discarded – undo
101 102
             );
102 103
         }
103 104
 
104
-        if ($tokenID === null) {
105
+        if ($tokenID === null)
106
+        {
105 107
             $cookieQueue->delete($this->cookie);
106
-        } else {
108
+        }
109
+        else
110
+        {
107 111
             $cookieQueue->set(
108 112
                 $this->cookie,
109 113
                 $tokenID,
@@ -134,7 +138,8 @@  discard block
 block discarded – undo
134 138
      */
135 139
     private function getLifetime(\DateTimeInterface $expiresAt = null): ?int
136 140
     {
137
-        if ($expiresAt === null) {
141
+        if ($expiresAt === null)
142
+        {
138 143
             return null;
139 144
         }
140 145
 
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.
src/AuthHttp/tests/Stub/TestAuthHttpStorage.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 load(string $id): ?TokenInterface
20 20
     {
21
-        if ($id === 'bad') {
21
+        if ($id === 'bad'){
22 22
             return null;
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 load(string $id): ?TokenInterface
20 20
     {
21
-        if ($id === 'bad') {
21
+        if ($id === 'bad')
22
+        {
22 23
             return null;
23 24
         }
24 25
 
Please login to merge, or discard this patch.
src/Tokenizer/src/ClassLocator.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function getClasses($target = null): array
25 25
     {
26
-        if (!empty($target) && (is_object($target) || is_string($target))) {
26
+        if (!empty($target) && (is_object($target) || is_string($target))){
27 27
             $target = new \ReflectionClass($target);
28 28
         }
29 29
 
30 30
         $result = [];
31
-        foreach ($this->availableClasses() as $class) {
32
-            try {
31
+        foreach ($this->availableClasses() as $class){
32
+            try{
33 33
                 $reflection = $this->classReflection($class);
34
-            } catch (LocatorException $e) {
34
+            }catch (LocatorException $e){
35 35
                 //Ignoring
36 36
                 continue;
37 37
             }
38 38
 
39
-            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) {
39
+            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()){
40 40
                 continue;
41 41
             }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $classes = [];
57 57
 
58
-        foreach ($this->availableReflections() as $reflection) {
58
+        foreach ($this->availableReflections() as $reflection){
59 59
             $classes = array_merge($classes, $reflection->getClasses());
60 60
         }
61 61
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool
73 73
     {
74
-        if (empty($target)) {
74
+        if (empty($target)){
75 75
             return true;
76 76
         }
77 77
 
78
-        if (!$target->isTrait()) {
78
+        if (!$target->isTrait()){
79 79
             //Target is interface or class
80 80
             return $class->isSubclassOf($target) || $class->getName() == $target->getName();
81 81
         }
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,20 +23,26 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function getClasses($target = null): array
25 25
     {
26
-        if (!empty($target) && (is_object($target) || is_string($target))) {
26
+        if (!empty($target) && (is_object($target) || is_string($target)))
27
+        {
27 28
             $target = new \ReflectionClass($target);
28 29
         }
29 30
 
30 31
         $result = [];
31
-        foreach ($this->availableClasses() as $class) {
32
-            try {
32
+        foreach ($this->availableClasses() as $class)
33
+        {
34
+            try
35
+            {
33 36
                 $reflection = $this->classReflection($class);
34
-            } catch (LocatorException $e) {
37
+            }
38
+            catch (LocatorException $e)
39
+            {
35 40
                 //Ignoring
36 41
                 continue;
37 42
             }
38 43
 
39
-            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) {
44
+            if (!$this->isTargeted($reflection, $target) || $reflection->isInterface())
45
+            {
40 46
                 continue;
41 47
             }
42 48
 
@@ -55,7 +61,8 @@  discard block
 block discarded – undo
55 61
     {
56 62
         $classes = [];
57 63
 
58
-        foreach ($this->availableReflections() as $reflection) {
64
+        foreach ($this->availableReflections() as $reflection)
65
+        {
59 66
             $classes = array_merge($classes, $reflection->getClasses());
60 67
         }
61 68
 
@@ -71,11 +78,13 @@  discard block
 block discarded – undo
71 78
      */
72 79
     protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool
73 80
     {
74
-        if (empty($target)) {
81
+        if (empty($target))
82
+        {
75 83
             return true;
76 84
         }
77 85
 
78
-        if (!$target->isTrait()) {
86
+        if (!$target->isTrait())
87
+        {
79 88
             //Target is interface or class
80 89
             return $class->isSubclassOf($target) || $class->getName() == $target->getName();
81 90
         }
Please login to merge, or discard this patch.