@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | CookiesConfig $cookiesConfig, |
| 55 | 55 | SessionFactoryInterface $factory, |
| 56 | 56 | ScopeInterface $scope |
| 57 | - ) { |
|
| 57 | + ){ |
|
| 58 | 58 | $this->config = $config; |
| 59 | 59 | $this->httpConfig = $httpConfig; |
| 60 | 60 | $this->cookiesConfig = $cookiesConfig; |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | $this->fetchID($request) |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - try { |
|
| 76 | + try{ |
|
| 77 | 77 | $response = $this->scope->runScope( |
| 78 | 78 | [SessionInterface::class => $session], |
| 79 | 79 | function () use ($handler, $request, $session) { |
| 80 | 80 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
| 81 | 81 | } |
| 82 | 82 | ); |
| 83 | - } catch (\Throwable $e) { |
|
| 83 | + }catch (\Throwable $e){ |
|
| 84 | 84 | $session->abort(); |
| 85 | 85 | throw $e; |
| 86 | 86 | } |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | Request $request, |
| 100 | 100 | Response $response |
| 101 | 101 | ): Response { |
| 102 | - if (!$session->isStarted()) { |
|
| 102 | + if (!$session->isStarted()){ |
|
| 103 | 103 | return $response; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $session->commit(); |
| 107 | 107 | |
| 108 | 108 | //SID changed |
| 109 | - if ($this->fetchID($request) != $session->getID()) { |
|
| 109 | + if ($this->fetchID($request) != $session->getID()){ |
|
| 110 | 110 | return $this->withCookie($request, $response, $session->getID()); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | protected function fetchID(Request $request): ?string |
| 124 | 124 | { |
| 125 | 125 | $cookies = $request->getCookieParams(); |
| 126 | - if (empty($cookies[$this->config->getCookie()])) { |
|
| 126 | + if (empty($cookies[$this->config->getCookie()])){ |
|
| 127 | 127 | return null; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | protected function clientSignature(Request $request): string |
| 155 | 155 | { |
| 156 | 156 | $signature = ''; |
| 157 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
| 158 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
| 157 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
| 158 | + $signature .= $request->getHeaderLine($header).';'; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return hash('sha256', $signature); |
@@ -37,15 +37,15 @@ |
||
| 37 | 37 | |
| 38 | 38 | public function initSession(string $clientSignature, string $id = null): SessionInterface |
| 39 | 39 | { |
| 40 | - if (session_status() === PHP_SESSION_ACTIVE) { |
|
| 40 | + if (session_status() === PHP_SESSION_ACTIVE){ |
|
| 41 | 41 | throw new MultipleSessionException('Unable to initiate session, session already started'); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Initiating proper session handler |
| 45 | - if ($this->config->getHandler() !== null) { |
|
| 46 | - try { |
|
| 45 | + if ($this->config->getHandler() !== null){ |
|
| 46 | + try{ |
|
| 47 | 47 | $handler = $this->config->getHandler()->resolve($this->factory); |
| 48 | - } catch (\Throwable | ContainerExceptionInterface $e) { |
|
| 48 | + }catch (\Throwable | ContainerExceptionInterface $e){ |
|
| 49 | 49 | throw new SessionException($e->getMessage(), $e->getCode(), $e); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -37,15 +37,20 @@ |
||
| 37 | 37 | |
| 38 | 38 | public function initSession(string $clientSignature, string $id = null): SessionInterface |
| 39 | 39 | { |
| 40 | - if (session_status() === PHP_SESSION_ACTIVE) { |
|
| 40 | + if (session_status() === PHP_SESSION_ACTIVE) |
|
| 41 | + { |
|
| 41 | 42 | throw new MultipleSessionException('Unable to initiate session, session already started'); |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | // Initiating proper session handler |
| 45 | - if ($this->config->getHandler() !== null) { |
|
| 46 | - try { |
|
| 46 | + if ($this->config->getHandler() !== null) |
|
| 47 | + { |
|
| 48 | + try |
|
| 49 | + { |
|
| 47 | 50 | $handler = $this->config->getHandler()->resolve($this->factory); |
| 48 | - } catch (\Throwable | ContainerExceptionInterface $e) { |
|
| 51 | + } |
|
| 52 | + catch (\Throwable | ContainerExceptionInterface $e) |
|
| 53 | + { |
|
| 49 | 54 | throw new SessionException($e->getMessage(), $e->getCode(), $e); |
| 50 | 55 | } |
| 51 | 56 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | 'handler' => new Autowire( |
| 63 | 63 | FileHandler::class, |
| 64 | 64 | [ |
| 65 | - 'directory' => $directories->get('runtime') . 'session', |
|
| 65 | + 'directory' => $directories->get('runtime').'session', |
|
| 66 | 66 | 'lifetime' => 86400, |
| 67 | 67 | ] |
| 68 | 68 | ), |