@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | private readonly ContainerInterface $container, |
| 44 | 44 | private readonly BinderInterface $binder, |
| 45 | 45 | private readonly ConfiguratorInterface $config |
| 46 | - ) { |
|
| 46 | + ){ |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function defineSingletons(): array |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ): FilterProvider { |
| 114 | 114 | $pipeline = (new InterceptorPipeline($dispatcher))->withHandler(new Core()); |
| 115 | 115 | |
| 116 | - foreach ($config->getInterceptors() as $interceptor) { |
|
| 116 | + foreach ($config->getInterceptors() as $interceptor){ |
|
| 117 | 117 | $pipeline->addInterceptor($container->get($interceptor)); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | public function __construct( |
| 24 | 24 | #[Proxy] private readonly ContainerInterface $container, |
| 25 | - ) { |
|
| 25 | + ){ |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | private function getRequest(): ServerRequestInterface |
| 153 | 153 | { |
| 154 | - try { |
|
| 154 | + try{ |
|
| 155 | 155 | return $this->container->get(ServerRequestInterface::class); |
| 156 | - } catch (NotFoundExceptionInterface $e) { |
|
| 156 | + }catch (NotFoundExceptionInterface $e){ |
|
| 157 | 157 | throw new ScopeException('Unable to receive active request', $e->getCode(), $e); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | private function getCookieQueue(): CookieQueue |
| 165 | 165 | { |
| 166 | - try { |
|
| 166 | + try{ |
|
| 167 | 167 | return $this->container->get(CookieQueue::class); |
| 168 | - } catch (NotFoundExceptionInterface $e) { |
|
| 168 | + }catch (NotFoundExceptionInterface $e){ |
|
| 169 | 169 | throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e); |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | public function __construct( |
| 19 | 19 | #[Proxy] private readonly ContainerInterface $container |
| 20 | - ) { |
|
| 20 | + ){ |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | private function getAuthContext(): AuthContextInterface |
| 72 | 72 | { |
| 73 | - try { |
|
| 73 | + try{ |
|
| 74 | 74 | return $this->container->get(AuthContextInterface::class); |
| 75 | - } catch (NotFoundExceptionInterface $e) { |
|
| 75 | + }catch (NotFoundExceptionInterface $e){ |
|
| 76 | 76 | throw new ScopeException('Unable to resolve auth context, invalid scope', $e->getCode(), $e); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | public function __construct( |
| 21 | 21 | #[Proxy] private readonly ContainerInterface $container |
| 22 | - ) { |
|
| 22 | + ){ |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | private function getTokenStorage(): TokenStorageInterface |
| 59 | 59 | { |
| 60 | - try { |
|
| 60 | + try{ |
|
| 61 | 61 | return $this->container->get(TokenStorageInterface::class); |
| 62 | - } catch (NotFoundExceptionInterface $e) { |
|
| 62 | + }catch (NotFoundExceptionInterface $e){ |
|
| 63 | 63 | throw new ScopeException('Unable to resolve token storage, invalid scope', $e->getCode(), $e); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | #[Proxy] ContainerInterface $container, |
| 24 | 24 | private readonly FactoryInterface $factory, |
| 25 | 25 | private readonly DirectoriesInterface $dirs, |
| 26 | - ) { |
|
| 26 | + ){ |
|
| 27 | 27 | $this->setContainer($container); |
| 28 | 28 | |
| 29 | 29 | parent::__construct(); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $className = $declaration->getClass()->getName(); |
| 64 | 64 | $relativeFilename = \str_replace($rootDirectory, '', $filename); |
| 65 | 65 | |
| 66 | - if ($this->files->exists($filename)) { |
|
| 66 | + if ($this->files->exists($filename)){ |
|
| 67 | 67 | $this->writeln( |
| 68 | 68 | \sprintf("<fg=red>Unable to create '<comment>%s</comment>' declaration, ", $className) |
| 69 | 69 | . \sprintf("file '<comment>%s</comment>' already exists.</fg=red>", $relativeFilename), |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | . \sprintf("has been successfully written into '<comment>%s</comment>'.", $relativeFilename), |
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | - if ($declaration instanceof HasInstructions && \count($declaration->getInstructions()) > 0) { |
|
| 83 | + if ($declaration instanceof HasInstructions && \count($declaration->getInstructions()) > 0){ |
|
| 84 | 84 | $this->newLine(); |
| 85 | 85 | $this->writeln('<fg=green>Next steps:</fg=green>'); |
| 86 | 86 | |
| 87 | - foreach ($declaration->getInstructions() as $i => $instruction) { |
|
| 87 | + foreach ($declaration->getInstructions() as $i => $instruction){ |
|
| 88 | 88 | $this->writeln(\sprintf('%d. %s', (string)(++$i), $instruction)); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | $request |
| 34 | 34 | ->expects($this->exactly(2)) |
| 35 | 35 | ->method('withAttribute') |
| 36 | - ->willReturnCallback(function (string $key, string $value) use ($matcher, $tokenStorage) { |
|
| 36 | + ->willReturnCallback(function (string $key, string $value) use ($matcher, $tokenStorage) |
|
| 37 | + { |
|
| 37 | 38 | match ($matcher->numberOfInvocations()) { |
| 38 | 39 | 1 => $this->assertInstanceOf(AuthContextInterface::class, $value), |
| 39 | 40 | 2 => $this->assertSame($tokenStorage, $value), |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $http->setHandler( |
| 28 | 28 | static function (ServerRequestInterface $request): void { |
| 29 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 29 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
| 30 | 30 | echo 'no token'; |
| 31 | - } else { |
|
| 31 | + }else{ |
|
| 32 | 32 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 33 | 33 | echo ':'; |
| 34 | 34 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $http->setHandler( |
| 52 | 52 | static function (ServerRequestInterface $request): void { |
| 53 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 53 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
| 54 | 54 | echo 'no token'; |
| 55 | - } else { |
|
| 55 | + }else{ |
|
| 56 | 56 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 57 | 57 | echo ':'; |
| 58 | 58 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $http->setHandler( |
| 75 | 75 | static function (ServerRequestInterface $request): void { |
| 76 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 76 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
| 77 | 77 | echo 'no token'; |
| 78 | - } else { |
|
| 78 | + }else{ |
|
| 79 | 79 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 80 | 80 | echo ':'; |
| 81 | 81 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | ); |
| 104 | 104 | $response = $http->handle( |
| 105 | - new ServerRequest('GET', '',['X-Auth-Token' => 'bad'], 'php://input') |
|
| 105 | + new ServerRequest('GET', '', ['X-Auth-Token' => 'bad'], 'php://input') |
|
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | 108 | self::assertEmpty($response->getHeader('X-Auth-Token')); |
@@ -26,9 +26,12 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $http->setHandler( |
| 28 | 28 | static function (ServerRequestInterface $request): void { |
| 29 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 29 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
| 30 | + { |
|
| 30 | 31 | echo 'no token'; |
| 31 | - } else { |
|
| 32 | + } |
|
| 33 | + else |
|
| 34 | + { |
|
| 32 | 35 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 33 | 36 | echo ':'; |
| 34 | 37 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -50,9 +53,12 @@ discard block |
||
| 50 | 53 | |
| 51 | 54 | $http->setHandler( |
| 52 | 55 | static function (ServerRequestInterface $request): void { |
| 53 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 56 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
| 57 | + { |
|
| 54 | 58 | echo 'no token'; |
| 55 | - } else { |
|
| 59 | + } |
|
| 60 | + else |
|
| 61 | + { |
|
| 56 | 62 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 57 | 63 | echo ':'; |
| 58 | 64 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -73,9 +79,12 @@ discard block |
||
| 73 | 79 | |
| 74 | 80 | $http->setHandler( |
| 75 | 81 | static function (ServerRequestInterface $request): void { |
| 76 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
| 82 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
| 83 | + { |
|
| 77 | 84 | echo 'no token'; |
| 78 | - } else { |
|
| 85 | + } |
|
| 86 | + else |
|
| 87 | + { |
|
| 79 | 88 | echo $request->getAttribute('authContext')->getToken()->getID(); |
| 80 | 89 | echo ':'; |
| 81 | 90 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | private readonly TokenStorageInterface $tokenStorage, |
| 34 | 34 | private readonly TransportRegistry $transportRegistry, |
| 35 | 35 | private readonly ?EventDispatcherInterface $eventDispatcher = null, |
| 36 | - ) { |
|
| 36 | + ){ |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
| 56 | 56 | { |
| 57 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
| 57 | + foreach ($this->transportRegistry->getTransports() as $name => $transport){ |
|
| 58 | 58 | $tokenID = $transport->fetchToken($request); |
| 59 | - if ($tokenID === null) { |
|
| 59 | + if ($tokenID === null){ |
|
| 60 | 60 | continue; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $token = $this->tokenStorage->load($tokenID); |
| 64 | - if ($token === null) { |
|
| 64 | + if ($token === null){ |
|
| 65 | 65 | continue; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
| 77 | 77 | { |
| 78 | - if ($authContext->getToken() === null) { |
|
| 78 | + if ($authContext->getToken() === null){ |
|
| 79 | 79 | return $response; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
| 83 | 83 | |
| 84 | - if ($authContext->isClosed()) { |
|
| 84 | + if ($authContext->isClosed()){ |
|
| 85 | 85 | $this->tokenStorage->delete($authContext->getToken()); |
| 86 | 86 | |
| 87 | 87 | return $transport->removeToken( |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function testCookieQueueInRequestAttribute(): void |
| 53 | 53 | { |
| 54 | 54 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 55 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 55 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 56 | 56 | $this->assertInstanceOf(CookieQueue::class, $r->getAttribute(CookieQueue::ATTRIBUTE)); |
| 57 | 57 | return 'all good'; |
| 58 | 58 | }); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | public function testSetEncryptedCookie(): void |
| 66 | 66 | { |
| 67 | 67 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 68 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 68 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 69 | 69 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 70 | 70 | |
| 71 | 71 | return 'all good'; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function testSetNotProtectedCookie(): void |
| 87 | 87 | { |
| 88 | 88 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 89 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 89 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 90 | 90 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('PHPSESSID', 'value'); |
| 91 | 91 | |
| 92 | 92 | return 'all good'; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function testDecrypt(): void |
| 105 | 105 | { |
| 106 | 106 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 107 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 107 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 108 | 108 | return $r->getCookieParams()['name']; |
| 109 | 109 | }); |
| 110 | 110 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | public function testDecryptArray(): void |
| 119 | 119 | { |
| 120 | 120 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 121 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 121 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 122 | 122 | return $r->getCookieParams()['name'][0]; |
| 123 | 123 | }); |
| 124 | 124 | |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | public function testDecryptBroken(): void |
| 133 | 133 | { |
| 134 | 134 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 135 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 135 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 136 | 136 | return $r->getCookieParams()['name']; |
| 137 | 137 | }); |
| 138 | 138 | |
| 139 | - $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value') . 'BROKEN'; |
|
| 139 | + $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value').'BROKEN'; |
|
| 140 | 140 | |
| 141 | 141 | $response = $this->get($core, '/', [], [], ['name' => $value]); |
| 142 | 142 | $this->assertSame(200, $response->getStatusCode()); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | public function testDelete(): void |
| 147 | 147 | { |
| 148 | 148 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 149 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 149 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 150 | 150 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 151 | 151 | $r->getAttribute(CookieQueue::ATTRIBUTE)->delete('name'); |
| 152 | 152 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ])); |
| 172 | 172 | |
| 173 | 173 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 174 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 174 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 175 | 175 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 176 | 176 | |
| 177 | 177 | return 'all good'; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | ])); |
| 196 | 196 | |
| 197 | 197 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 198 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 198 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 199 | 199 | return $r->getCookieParams()['name']; |
| 200 | 200 | }); |
| 201 | 201 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | ])); |
| 216 | 216 | |
| 217 | 217 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 218 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 218 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
| 219 | 219 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 220 | 220 | |
| 221 | 221 | return 'all good'; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $cookies = $this->fetchCookies($response); |
| 229 | 229 | $this->assertArrayHasKey('name', $cookies); |
| 230 | 230 | |
| 231 | - $core->setHandler(function ($r) { |
|
| 231 | + $core->setHandler(function ($r){ |
|
| 232 | 232 | return $r->getCookieParams()['name']; |
| 233 | 233 | }); |
| 234 | 234 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | { |
| 284 | 284 | $result = []; |
| 285 | 285 | |
| 286 | - foreach ($response->getHeaders() as $line) { |
|
| 286 | + foreach ($response->getHeaders() as $line){ |
|
| 287 | 287 | $cookie = explode('=', implode('', $line)); |
| 288 | 288 | $result[$cookie[0]] = rawurldecode(substr( |
| 289 | 289 | (string)$cookie[1], |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | public function testCookieQueueInRequestAttribute(): void |
| 53 | 53 | { |
| 54 | 54 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 55 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 55 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 56 | + { |
|
| 56 | 57 | $this->assertInstanceOf(CookieQueue::class, $r->getAttribute(CookieQueue::ATTRIBUTE)); |
| 57 | 58 | return 'all good'; |
| 58 | 59 | }); |
@@ -65,7 +66,8 @@ discard block |
||
| 65 | 66 | public function testSetEncryptedCookie(): void |
| 66 | 67 | { |
| 67 | 68 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 68 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 69 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 70 | + { |
|
| 69 | 71 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 70 | 72 | |
| 71 | 73 | return 'all good'; |
@@ -86,7 +88,8 @@ discard block |
||
| 86 | 88 | public function testSetNotProtectedCookie(): void |
| 87 | 89 | { |
| 88 | 90 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 89 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 91 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 92 | + { |
|
| 90 | 93 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('PHPSESSID', 'value'); |
| 91 | 94 | |
| 92 | 95 | return 'all good'; |
@@ -104,7 +107,8 @@ discard block |
||
| 104 | 107 | public function testDecrypt(): void |
| 105 | 108 | { |
| 106 | 109 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 107 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 110 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 111 | + { |
|
| 108 | 112 | return $r->getCookieParams()['name']; |
| 109 | 113 | }); |
| 110 | 114 | |
@@ -118,7 +122,8 @@ discard block |
||
| 118 | 122 | public function testDecryptArray(): void |
| 119 | 123 | { |
| 120 | 124 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 121 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 125 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 126 | + { |
|
| 122 | 127 | return $r->getCookieParams()['name'][0]; |
| 123 | 128 | }); |
| 124 | 129 | |
@@ -132,7 +137,8 @@ discard block |
||
| 132 | 137 | public function testDecryptBroken(): void |
| 133 | 138 | { |
| 134 | 139 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 135 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 140 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 141 | + { |
|
| 136 | 142 | return $r->getCookieParams()['name']; |
| 137 | 143 | }); |
| 138 | 144 | |
@@ -146,7 +152,8 @@ discard block |
||
| 146 | 152 | public function testDelete(): void |
| 147 | 153 | { |
| 148 | 154 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 149 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 155 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 156 | + { |
|
| 150 | 157 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 151 | 158 | $r->getAttribute(CookieQueue::ATTRIBUTE)->delete('name'); |
| 152 | 159 | |
@@ -171,7 +178,8 @@ discard block |
||
| 171 | 178 | ])); |
| 172 | 179 | |
| 173 | 180 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 174 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 181 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 182 | + { |
|
| 175 | 183 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 176 | 184 | |
| 177 | 185 | return 'all good'; |
@@ -195,7 +203,8 @@ discard block |
||
| 195 | 203 | ])); |
| 196 | 204 | |
| 197 | 205 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 198 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 206 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 207 | + { |
|
| 199 | 208 | return $r->getCookieParams()['name']; |
| 200 | 209 | }); |
| 201 | 210 | |
@@ -215,7 +224,8 @@ discard block |
||
| 215 | 224 | ])); |
| 216 | 225 | |
| 217 | 226 | $core = $this->httpCore([CookiesMiddleware::class]); |
| 218 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
| 227 | + $core->setHandler(function (ServerRequestInterface $r) |
|
| 228 | + { |
|
| 219 | 229 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
| 220 | 230 | |
| 221 | 231 | return 'all good'; |
@@ -228,7 +238,8 @@ discard block |
||
| 228 | 238 | $cookies = $this->fetchCookies($response); |
| 229 | 239 | $this->assertArrayHasKey('name', $cookies); |
| 230 | 240 | |
| 231 | - $core->setHandler(function ($r) { |
|
| 241 | + $core->setHandler(function ($r) |
|
| 242 | + { |
|
| 232 | 243 | return $r->getCookieParams()['name']; |
| 233 | 244 | }); |
| 234 | 245 | |
@@ -283,7 +294,8 @@ discard block |
||
| 283 | 294 | { |
| 284 | 295 | $result = []; |
| 285 | 296 | |
| 286 | - foreach ($response->getHeaders() as $line) { |
|
| 297 | + foreach ($response->getHeaders() as $line) |
|
| 298 | + { |
|
| 287 | 299 | $cookie = explode('=', implode('', $line)); |
| 288 | 300 | $result[$cookie[0]] = rawurldecode(substr( |
| 289 | 301 | (string)$cookie[1], |