Passed
Pull Request — master (#218)
by Anton
02:57
created
tests/Framework/Http/SessionTest.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testSetSid()
17 17
     {
18
-        $this->http->setHandler(function () {
18
+        $this->http->setHandler(function ()
19
+        {
19 20
             return ++$this->session()->getSection('cli')->value;
20 21
         });
21 22
 
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
 
30 31
     public function testSessionResume()
31 32
     {
32
-        $this->http->setHandler(function () {
33
+        $this->http->setHandler(function ()
34
+        {
33 35
             return ++$this->session()->getSection('cli')->value;
34 36
         });
35 37
 
@@ -53,7 +55,8 @@  discard block
 block discarded – undo
53 55
 
54 56
     public function testSessionRegenerateId()
55 57
     {
56
-        $this->http->setHandler(function () {
58
+        $this->http->setHandler(function ()
59
+        {
57 60
             return ++$this->session()->getSection('cli')->value;
58 61
         });
59 62
 
@@ -70,7 +73,8 @@  discard block
 block discarded – undo
70 73
         $this->assertSame(200, $result->getStatusCode());
71 74
         $this->assertSame('2', $result->getBody()->__toString());
72 75
 
73
-        $this->http->setHandler(function () {
76
+        $this->http->setHandler(function ()
77
+        {
74 78
             $this->session()->regenerateID(false);
75 79
 
76 80
             return ++$this->session()->getSection('cli')->value;
@@ -89,7 +93,8 @@  discard block
 block discarded – undo
89 93
 
90 94
     public function testDestroySession()
91 95
     {
92
-        $this->http->setHandler(function () {
96
+        $this->http->setHandler(function ()
97
+        {
93 98
             return ++$this->session()->getSection('cli')->value;
94 99
         });
95 100
 
@@ -102,7 +107,8 @@  discard block
 block discarded – undo
102 107
         ]);
103 108
         $this->assertSame(200, $result->getStatusCode());
104 109
         $this->assertSame('2', $result->getBody()->__toString());
105
-        $this->http->setHandler(function () {
110
+        $this->http->setHandler(function ()
111
+        {
106 112
             $this->session()->destroy();
107 113
             $this->assertFalse($this->session()->isStarted());
108 114
 
Please login to merge, or discard this patch.
src/Session/SessionScope.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -120,15 +120,19 @@
 block discarded – undo
120 120
      */
121 121
     private function getSession(): SessionInterface
122 122
     {
123
-        try {
123
+        try
124
+        {
124 125
             $request = $this->container->get(ServerRequestInterface::class);
125 126
             $session = $request->getAttribute(SessionMiddleware::ATTRIBUTE);
126
-            if ($session === null) {
127
+            if ($session === null)
128
+            {
127 129
                 throw new ScopeException("Unable to receive active Session, invalid request scope");
128 130
             }
129 131
 
130 132
             return $session;
131
-        } catch (NotFoundExceptionInterface $e) {
133
+        }
134
+        catch (NotFoundExceptionInterface $e)
135
+        {
132 136
             throw new ScopeException("Unable to receive active session", $e->getCode(), $e);
133 137
         }
134 138
     }
Please login to merge, or discard this patch.
src/Session/Middleware/SessionMiddleware.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,9 +76,12 @@  discard block
 block discarded – undo
76 76
             $this->fetchID($request)
77 77
         );
78 78
 
79
-        try {
79
+        try
80
+        {
80 81
             $response = $handler->handle($request->withAttribute(static::ATTRIBUTE, $session));
81
-        } catch (\Throwable $e) {
82
+        }
83
+        catch (\Throwable $e)
84
+        {
82 85
             $session->abort();
83 86
             throw $e;
84 87
         }
@@ -97,14 +100,16 @@  discard block
 block discarded – undo
97 100
         Request $request,
98 101
         Response $response
99 102
     ): Response {
100
-        if (!$session->isStarted()) {
103
+        if (!$session->isStarted())
104
+        {
101 105
             return $response;
102 106
         }
103 107
 
104 108
         $session->commit();
105 109
 
106 110
         //SID changed
107
-        if ($this->fetchID($request) != $session->getID()) {
111
+        if ($this->fetchID($request) != $session->getID())
112
+        {
108 113
             return $this->withCookie($request, $response, $session->getID());
109 114
         }
110 115
 
@@ -121,7 +126,8 @@  discard block
 block discarded – undo
121 126
     protected function fetchID(Request $request): ?string
122 127
     {
123 128
         $cookies = $request->getCookieParams();
124
-        if (empty($cookies[$this->config->getCookie()])) {
129
+        if (empty($cookies[$this->config->getCookie()]))
130
+        {
125 131
             return null;
126 132
         }
127 133
 
@@ -154,7 +160,8 @@  discard block
 block discarded – undo
154 160
     protected function clientSignature(Request $request): string
155 161
     {
156 162
         $signature = '';
157
-        foreach (static::SIGNATURE_HEADERS as $header) {
163
+        foreach (static::SIGNATURE_HEADERS as $header)
164
+        {
158 165
             $signature .= $request->getHeaderLine($header) . ';';
159 166
         }
160 167
 
Please login to merge, or discard this patch.
src/Cookies/CookieManager.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -158,9 +158,12 @@  discard block
 block discarded – undo
158 158
      */
159 159
     private function getRequest(): ServerRequestInterface
160 160
     {
161
-        try {
161
+        try
162
+        {
162 163
             return $this->container->get(ServerRequestInterface::class);
163
-        } catch (NotFoundExceptionInterface $e) {
164
+        }
165
+        catch (NotFoundExceptionInterface $e)
166
+        {
164 167
             throw new ScopeException("Unable to receive active request", $e->getCode(), $e);
165 168
         }
166 169
     }
@@ -174,7 +177,8 @@  discard block
 block discarded – undo
174 177
     {
175 178
         $request = $this->getRequest();
176 179
         $queue = $request->getAttribute(CookieQueue::ATTRIBUTE, null);
177
-        if ($queue === null) {
180
+        if ($queue === null)
181
+        {
178 182
             throw new ScopeException("Unable to receive cookie queue, invalid request scope");
179 183
         }
180 184
 
Please login to merge, or discard this patch.
src/Bootloader/Http/CookiesBootloader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
     private function cookieQueue(ServerRequestInterface $request): CookieQueue
72 72
     {
73 73
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null);
74
-        if ($cookieQueue === null) {
74
+        if ($cookieQueue === null)
75
+        {
75 76
             throw new ScopeException("Unable to resolve CookieQueue, invalid request scope");
76 77
         }
77 78
 
Please login to merge, or discard this patch.
src/Bootloader/Http/RouterBootloader.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@
 block discarded – undo
56 56
     private function route(ServerRequestInterface $request): RouteInterface
57 57
     {
58 58
         $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null);
59
-        if ($route === null) {
59
+        if ($route === null)
60
+        {
60 61
             throw new ScopeException("Unable to resolve Route, invalid request scope");
61 62
         }
62 63
 
Please login to merge, or discard this patch.