@@ -124,15 +124,19 @@ |
||
| 124 | 124 | */ |
| 125 | 125 | public function getActiveSession(): SessionInterface |
| 126 | 126 | { |
| 127 | - try { |
|
| 127 | + try |
|
| 128 | + { |
|
| 128 | 129 | $request = $this->container->get(ServerRequestInterface::class); |
| 129 | 130 | $session = $request->getAttribute(SessionMiddleware::ATTRIBUTE); |
| 130 | - if ($session === null) { |
|
| 131 | + if ($session === null) |
|
| 132 | + { |
|
| 131 | 133 | throw new ScopeException('Unable to receive active Session, invalid request scope'); |
| 132 | 134 | } |
| 133 | 135 | |
| 134 | 136 | return $session; |
| 135 | - } catch (NotFoundExceptionInterface $e) { |
|
| 137 | + } |
|
| 138 | + catch (NotFoundExceptionInterface $e) |
|
| 139 | + { |
|
| 136 | 140 | throw new ScopeException('Unable to receive active session', $e->getCode(), $e); |
| 137 | 141 | } |
| 138 | 142 | } |
@@ -35,7 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function testHasCookie(): void |
| 37 | 37 | { |
| 38 | - $this->http->setHandler(function () { |
|
| 38 | + $this->http->setHandler(function () |
|
| 39 | + { |
|
| 39 | 40 | return (int)$this->cookies()->has('a'); |
| 40 | 41 | }); |
| 41 | 42 | |
@@ -53,7 +54,8 @@ discard block |
||
| 53 | 54 | ]); |
| 54 | 55 | $this->http = $this->app->get(Http::class); |
| 55 | 56 | |
| 56 | - $this->http->setHandler(function () { |
|
| 57 | + $this->http->setHandler(function () |
|
| 58 | + { |
|
| 57 | 59 | return (int)$this->cookies()->has('a'); |
| 58 | 60 | }); |
| 59 | 61 | |
@@ -70,7 +72,8 @@ discard block |
||
| 70 | 72 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
| 71 | 73 | $this->http = $this->app->get(Http::class); |
| 72 | 74 | |
| 73 | - $this->http->setHandler(function () { |
|
| 75 | + $this->http->setHandler(function () |
|
| 76 | + { |
|
| 74 | 77 | return $this->cookies()->get('a'); |
| 75 | 78 | }); |
| 76 | 79 | |
@@ -87,7 +90,8 @@ discard block |
||
| 87 | 90 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
| 88 | 91 | $this->http = $this->app->get(Http::class); |
| 89 | 92 | |
| 90 | - $this->http->setHandler(function () { |
|
| 93 | + $this->http->setHandler(function () |
|
| 94 | + { |
|
| 91 | 95 | $this->cookies()->set('a', 'value'); |
| 92 | 96 | |
| 93 | 97 | return 'ok'; |
@@ -111,7 +115,8 @@ discard block |
||
| 111 | 115 | $this->app = $this->makeApp(['ENCRYPTER_KEY' => $key]); |
| 112 | 116 | $this->http = $this->app->get(Http::class); |
| 113 | 117 | |
| 114 | - $this->http->setHandler(function () { |
|
| 118 | + $this->http->setHandler(function () |
|
| 119 | + { |
|
| 115 | 120 | $this->cookies()->schedule(Cookie::create('a', 'value')); |
| 116 | 121 | $this->assertSame([], $this->cookies()->getAll()); |
| 117 | 122 | |