@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | CookiesConfig $cookiesConfig, |
| 58 | 58 | SessionFactory $factory, |
| 59 | 59 | ScopeInterface $scope |
| 60 | - ) { |
|
| 60 | + ){ |
|
| 61 | 61 | $this->config = $config; |
| 62 | 62 | $this->httpConfig = $httpConfig; |
| 63 | 63 | $this->cookiesConfig = $cookiesConfig; |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | $this->fetchID($request) |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | - try { |
|
| 79 | + try{ |
|
| 80 | 80 | $response = $this->scope->runScope( |
| 81 | 81 | [SessionInterface::class => $session], |
| 82 | 82 | function () use ($session, $request, $handler) { |
| 83 | 83 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
| 84 | 84 | } |
| 85 | 85 | ); |
| 86 | - } catch (\Throwable $e) { |
|
| 86 | + }catch (\Throwable $e){ |
|
| 87 | 87 | $session->abort(); |
| 88 | 88 | throw $e; |
| 89 | 89 | } |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | Request $request, |
| 103 | 103 | Response $response |
| 104 | 104 | ): Response { |
| 105 | - if (!$session->isStarted()) { |
|
| 105 | + if (!$session->isStarted()){ |
|
| 106 | 106 | return $response; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $session->commit(); |
| 110 | 110 | |
| 111 | 111 | //SID changed |
| 112 | - if ($this->fetchID($request) != $session->getID()) { |
|
| 112 | + if ($this->fetchID($request) != $session->getID()){ |
|
| 113 | 113 | return $this->withCookie($request, $response, $session->getID()); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | protected function fetchID(Request $request): ?string |
| 127 | 127 | { |
| 128 | 128 | $cookies = $request->getCookieParams(); |
| 129 | - if (empty($cookies[$this->config->getCookie()])) { |
|
| 129 | + if (empty($cookies[$this->config->getCookie()])){ |
|
| 130 | 130 | return null; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | protected function clientSignature(Request $request): string |
| 160 | 160 | { |
| 161 | 161 | $signature = ''; |
| 162 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
| 163 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
| 162 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
| 163 | + $signature .= $request->getHeaderLine($header).';'; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return hash('sha256', $signature); |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | $http = $this->container->get(Http::class); |
| 58 | 58 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
| 59 | 59 | |
| 60 | - try { |
|
| 60 | + try{ |
|
| 61 | 61 | $response = $http->handle($this->initRequest()); |
| 62 | 62 | $emitter->emit($response); |
| 63 | - } catch (\Throwable $e) { |
|
| 63 | + }catch (\Throwable $e){ |
|
| 64 | 64 | $this->handleException($emitter, $e); |
| 65 | - } finally { |
|
| 65 | + }finally{ |
|
| 66 | 66 | $this->finalizer->finalize(false); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 85 | 85 | |
| 86 | - try { |
|
| 86 | + try{ |
|
| 87 | 87 | /** @var SnapshotInterface $snapshot */ |
| 88 | 88 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 89 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 89 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 90 | 90 | // nothing to report |
| 91 | 91 | } |
| 92 | 92 | |
@@ -57,12 +57,17 @@ discard block |
||
| 57 | 57 | $http = $this->container->get(Http::class); |
| 58 | 58 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
| 59 | 59 | |
| 60 | - try { |
|
| 60 | + try |
|
| 61 | + { |
|
| 61 | 62 | $response = $http->handle($this->initRequest()); |
| 62 | 63 | $emitter->emit($response); |
| 63 | - } catch (\Throwable $e) { |
|
| 64 | + } |
|
| 65 | + catch (\Throwable $e) |
|
| 66 | + { |
|
| 64 | 67 | $this->handleException($emitter, $e); |
| 65 | - } finally { |
|
| 68 | + } |
|
| 69 | + finally |
|
| 70 | + { |
|
| 66 | 71 | $this->finalizer->finalize(false); |
| 67 | 72 | } |
| 68 | 73 | } |
@@ -83,10 +88,13 @@ discard block |
||
| 83 | 88 | { |
| 84 | 89 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 85 | 90 | |
| 86 | - try { |
|
| 91 | + try |
|
| 92 | + { |
|
| 87 | 93 | /** @var SnapshotInterface $snapshot */ |
| 88 | 94 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 89 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 95 | + } |
|
| 96 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
| 97 | + { |
|
| 90 | 98 | // nothing to report |
| 91 | 99 | } |
| 92 | 100 | |
@@ -37,7 +37,7 @@ |
||
| 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 | |
@@ -37,7 +37,8 @@ |
||
| 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 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | FinalizerInterface $finalizer, |
| 47 | 47 | ContainerInterface $container, |
| 48 | 48 | FactoryInterface $factory |
| 49 | - ) { |
|
| 49 | + ){ |
|
| 50 | 50 | $this->env = $env; |
| 51 | 51 | $this->finalizer = $finalizer; |
| 52 | 52 | $this->container = $container; |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | /** @var Http $http */ |
| 72 | 72 | $http = $this->container->get(Http::class); |
| 73 | - while ($request = $client->acceptRequest()) { |
|
| 74 | - try { |
|
| 73 | + while ($request = $client->acceptRequest()){ |
|
| 74 | + try{ |
|
| 75 | 75 | $client->respond($http->handle($request)); |
| 76 | - } catch (\Throwable $e) { |
|
| 76 | + }catch (\Throwable $e){ |
|
| 77 | 77 | $this->handleException($client, $e); |
| 78 | - } finally { |
|
| 78 | + }finally{ |
|
| 79 | 79 | $this->finalizer->finalize(false); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 91 | 91 | |
| 92 | - try { |
|
| 92 | + try{ |
|
| 93 | 93 | /** @var SnapshotInterface $snapshot */ |
| 94 | 94 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 95 | 95 | error_log($snapshot->getMessage()); |
| 96 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 96 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 97 | 97 | error_log((string)$e); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -70,12 +70,18 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | /** @var Http $http */ |
| 72 | 72 | $http = $this->container->get(Http::class); |
| 73 | - while ($request = $client->acceptRequest()) { |
|
| 74 | - try { |
|
| 73 | + while ($request = $client->acceptRequest()) |
|
| 74 | + { |
|
| 75 | + try |
|
| 76 | + { |
|
| 75 | 77 | $client->respond($http->handle($request)); |
| 76 | - } catch (\Throwable $e) { |
|
| 78 | + } |
|
| 79 | + catch (\Throwable $e) |
|
| 80 | + { |
|
| 77 | 81 | $this->handleException($client, $e); |
| 78 | - } finally { |
|
| 82 | + } |
|
| 83 | + finally |
|
| 84 | + { |
|
| 79 | 85 | $this->finalizer->finalize(false); |
| 80 | 86 | } |
| 81 | 87 | } |
@@ -89,11 +95,14 @@ discard block |
||
| 89 | 95 | { |
| 90 | 96 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 91 | 97 | |
| 92 | - try { |
|
| 98 | + try |
|
| 99 | + { |
|
| 93 | 100 | /** @var SnapshotInterface $snapshot */ |
| 94 | 101 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 95 | 102 | error_log($snapshot->getMessage()); |
| 96 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 103 | + } |
|
| 104 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
| 105 | + { |
|
| 97 | 106 | error_log((string)$e); |
| 98 | 107 | } |
| 99 | 108 | |
@@ -50,13 +50,13 @@ |
||
| 50 | 50 | CookiesBootloader $cookies, |
| 51 | 51 | HttpBootloader $http, |
| 52 | 52 | DirectoriesInterface $directories |
| 53 | - ) { |
|
| 53 | + ){ |
|
| 54 | 54 | $config->setDefaults('session', [ |
| 55 | 55 | 'lifetime' => 86400, |
| 56 | 56 | 'cookie' => 'sid', |
| 57 | 57 | 'secure' => false, |
| 58 | 58 | 'handler' => new Autowire(FileHandler::class, [ |
| 59 | - 'directory' => $directories->get('runtime') . 'session', |
|
| 59 | + 'directory' => $directories->get('runtime').'session', |
|
| 60 | 60 | 'lifetime' => 86400 |
| 61 | 61 | ] |
| 62 | 62 | ) |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | $kernel->addDispatcher($factory->make(SapiDispatcher::class)); |
| 68 | 68 | |
| 69 | - if (class_exists(PSR7Client::class)) { |
|
| 69 | + if (class_exists(PSR7Client::class)){ |
|
| 70 | 70 | $kernel->addDispatcher($factory->make(RrDispacher::class)); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -66,7 +66,8 @@ |
||
| 66 | 66 | |
| 67 | 67 | $kernel->addDispatcher($factory->make(SapiDispatcher::class)); |
| 68 | 68 | |
| 69 | - if (class_exists(PSR7Client::class)) { |
|
| 69 | + if (class_exists(PSR7Client::class)) |
|
| 70 | + { |
|
| 70 | 71 | $kernel->addDispatcher($factory->make(RrDispacher::class)); |
| 71 | 72 | } |
| 72 | 73 | } |