@@ -70,14 +70,17 @@ discard block |
||
70 | 70 | |
71 | 71 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
72 | 72 | { |
73 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
73 | + foreach ($this->transportRegistry->getTransports() as $name => $transport) |
|
74 | + { |
|
74 | 75 | $tokenID = $transport->fetchToken($request); |
75 | - if ($tokenID === null) { |
|
76 | + if ($tokenID === null) |
|
77 | + { |
|
76 | 78 | continue; |
77 | 79 | } |
78 | 80 | |
79 | 81 | $token = $this->tokenStorage->load($tokenID); |
80 | - if ($token === null) { |
|
82 | + if ($token === null) |
|
83 | + { |
|
81 | 84 | continue; |
82 | 85 | } |
83 | 86 | |
@@ -91,13 +94,15 @@ discard block |
||
91 | 94 | |
92 | 95 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
93 | 96 | { |
94 | - if ($authContext->getToken() === null) { |
|
97 | + if ($authContext->getToken() === null) |
|
98 | + { |
|
95 | 99 | return $response; |
96 | 100 | } |
97 | 101 | |
98 | 102 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
99 | 103 | |
100 | - if ($authContext->isClosed()) { |
|
104 | + if ($authContext->isClosed()) |
|
105 | + { |
|
101 | 106 | $this->tokenStorage->delete($authContext->getToken()); |
102 | 107 | |
103 | 108 | return $transport->removeToken( |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | private readonly TokenStorageInterface $tokenStorage, |
30 | 30 | private readonly TransportRegistry $transportRegistry, |
31 | 31 | private readonly ?EventDispatcherInterface $eventDispatcher = null |
32 | - ) { |
|
32 | + ){ |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | |
50 | 50 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
51 | 51 | { |
52 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
52 | + foreach ($this->transportRegistry->getTransports() as $name => $transport){ |
|
53 | 53 | $tokenID = $transport->fetchToken($request); |
54 | - if ($tokenID === null) { |
|
54 | + if ($tokenID === null){ |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | |
58 | 58 | $token = $this->tokenStorage->load($tokenID); |
59 | - if ($token === null) { |
|
59 | + if ($token === null){ |
|
60 | 60 | continue; |
61 | 61 | } |
62 | 62 | |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | |
71 | 71 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
72 | 72 | { |
73 | - if ($authContext->getToken() === null) { |
|
73 | + if ($authContext->getToken() === null){ |
|
74 | 74 | return $response; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
78 | 78 | |
79 | - if ($authContext->isClosed()) { |
|
79 | + if ($authContext->isClosed()){ |
|
80 | 80 | $this->tokenStorage->delete($authContext->getToken()); |
81 | 81 | |
82 | 82 | return $transport->removeToken( |
@@ -30,7 +30,8 @@ |
||
30 | 30 | // Replaces alias with real storage name |
31 | 31 | $name = $this->config->getAliases()[$name] ?? $name; |
32 | 32 | |
33 | - if (isset($this->connections[$name])) { |
|
33 | + if (isset($this->connections[$name])) |
|
34 | + { |
|
34 | 35 | return $this->connections[$name]; |
35 | 36 | } |
36 | 37 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function __construct( |
17 | 17 | private readonly FactoryInterface $factory, |
18 | 18 | private readonly BroadcastConfig $config |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function connection(?string $name = null): BroadcastInterface |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // Replaces alias with real storage name |
27 | 27 | $name = $this->config->getAliases()[$name] ?? $name; |
28 | 28 | |
29 | - if (isset($this->connections[$name])) { |
|
29 | + if (isset($this->connections[$name])){ |
|
30 | 30 | return $this->connections[$name]; |
31 | 31 | } |
32 | 32 |
@@ -58,10 +58,10 @@ |
||
58 | 58 | */ |
59 | 59 | public function getChunkSize(): ?int |
60 | 60 | { |
61 | - if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) { |
|
61 | + if (\is_null($this->config['chunkSize']) || (int)$this->config['chunkSize'] < 0){ |
|
62 | 62 | return null; |
63 | 63 | } |
64 | 64 | |
65 | - return (int) $this->config['chunkSize']; |
|
65 | + return (int)$this->config['chunkSize']; |
|
66 | 66 | } |
67 | 67 | } |
@@ -58,7 +58,8 @@ |
||
58 | 58 | */ |
59 | 59 | public function getChunkSize(): ?int |
60 | 60 | { |
61 | - if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) { |
|
61 | + if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) |
|
62 | + { |
|
62 | 63 | return null; |
63 | 64 | } |
64 | 65 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct( |
14 | 14 | private readonly ProcessRunner $processRunner |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | public function __construct( |
14 | 14 | private readonly TagParserInterface $parser, |
15 | 15 | private ?string $gitDirectory = null |
16 | - ) { |
|
17 | - if ($gitDirectory === null) { |
|
16 | + ){ |
|
17 | + if ($gitDirectory === null){ |
|
18 | 18 | $this->gitDirectory = \dirname(__DIR__); |
19 | 19 | } |
20 | 20 | } |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | $mostRecentVersion = $this->findMostRecentVersion($version); |
33 | 33 | |
34 | 34 | // no tag yet |
35 | - if ($mostRecentVersion === null) { |
|
35 | + if ($mostRecentVersion === null){ |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | 39 | // validation |
40 | 40 | $mostRecentVersion = new Version(\strtolower($mostRecentVersion)); |
41 | - if ($version->isGreaterThan($mostRecentVersion)) { |
|
41 | + if ($version->isGreaterThan($mostRecentVersion)){ |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | private function findMostRecentVersion(Version $version): ?string |
53 | 53 | { |
54 | 54 | $tags = []; |
55 | - foreach ($this->parser->parse($this->gitDirectory) as $tag) { |
|
55 | + foreach ($this->parser->parse($this->gitDirectory) as $tag){ |
|
56 | 56 | $tag = new Version(\strtolower($tag)); |
57 | 57 | |
58 | 58 | // all previous major versions |
59 | - if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) { |
|
59 | + if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()){ |
|
60 | 60 | $tags[] = $tag; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // all minor versions up to the requested in the requested major version |
64 | - if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) { |
|
65 | - if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) { |
|
64 | + if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()){ |
|
65 | + if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()){ |
|
66 | 66 | $tags[] = $tag; |
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - if ($tags === []) { |
|
71 | + if ($tags === []){ |
|
72 | 72 | return null; |
73 | 73 | } |
74 | 74 |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | private readonly TagParserInterface $parser, |
15 | 15 | private ?string $gitDirectory = null |
16 | 16 | ) { |
17 | - if ($gitDirectory === null) { |
|
17 | + if ($gitDirectory === null) |
|
18 | + { |
|
18 | 19 | $this->gitDirectory = \dirname(__DIR__); |
19 | 20 | } |
20 | 21 | } |
@@ -32,13 +33,15 @@ discard block |
||
32 | 33 | $mostRecentVersion = $this->findMostRecentVersion($version); |
33 | 34 | |
34 | 35 | // no tag yet |
35 | - if ($mostRecentVersion === null) { |
|
36 | + if ($mostRecentVersion === null) |
|
37 | + { |
|
36 | 38 | return; |
37 | 39 | } |
38 | 40 | |
39 | 41 | // validation |
40 | 42 | $mostRecentVersion = new Version(\strtolower($mostRecentVersion)); |
41 | - if ($version->isGreaterThan($mostRecentVersion)) { |
|
43 | + if ($version->isGreaterThan($mostRecentVersion)) |
|
44 | + { |
|
42 | 45 | return; |
43 | 46 | } |
44 | 47 | |
@@ -52,23 +55,28 @@ discard block |
||
52 | 55 | private function findMostRecentVersion(Version $version): ?string |
53 | 56 | { |
54 | 57 | $tags = []; |
55 | - foreach ($this->parser->parse($this->gitDirectory) as $tag) { |
|
58 | + foreach ($this->parser->parse($this->gitDirectory) as $tag) |
|
59 | + { |
|
56 | 60 | $tag = new Version(\strtolower($tag)); |
57 | 61 | |
58 | 62 | // all previous major versions |
59 | - if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) { |
|
63 | + if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) |
|
64 | + { |
|
60 | 65 | $tags[] = $tag; |
61 | 66 | } |
62 | 67 | |
63 | 68 | // all minor versions up to the requested in the requested major version |
64 | - if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) { |
|
65 | - if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) { |
|
69 | + if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) |
|
70 | + { |
|
71 | + if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) |
|
72 | + { |
|
66 | 73 | $tags[] = $tag; |
67 | 74 | } |
68 | 75 | } |
69 | 76 | } |
70 | 77 | |
71 | - if ($tags === []) { |
|
78 | + if ($tags === []) |
|
79 | + { |
|
72 | 80 | return null; |
73 | 81 | } |
74 | 82 |
@@ -43,15 +43,15 @@ |
||
43 | 43 | */ |
44 | 44 | public function getHandler(): ?Autowire |
45 | 45 | { |
46 | - if (empty($this->config['handler'])) { |
|
46 | + if (empty($this->config['handler'])){ |
|
47 | 47 | return null; |
48 | 48 | } |
49 | 49 | |
50 | - if ($this->config['handler'] instanceof Autowire) { |
|
50 | + if ($this->config['handler'] instanceof Autowire){ |
|
51 | 51 | return $this->config['handler']; |
52 | 52 | } |
53 | 53 | |
54 | - if (\class_exists($this->config['handler'])) { |
|
54 | + if (\class_exists($this->config['handler'])){ |
|
55 | 55 | return new Autowire($this->config['handler']); |
56 | 56 | } |
57 | 57 |
@@ -43,15 +43,18 @@ |
||
43 | 43 | */ |
44 | 44 | public function getHandler(): ?Autowire |
45 | 45 | { |
46 | - if (empty($this->config['handler'])) { |
|
46 | + if (empty($this->config['handler'])) |
|
47 | + { |
|
47 | 48 | return null; |
48 | 49 | } |
49 | 50 | |
50 | - if ($this->config['handler'] instanceof Autowire) { |
|
51 | + if ($this->config['handler'] instanceof Autowire) |
|
52 | + { |
|
51 | 53 | return $this->config['handler']; |
52 | 54 | } |
53 | 55 | |
54 | - if (\class_exists($this->config['handler'])) { |
|
56 | + if (\class_exists($this->config['handler'])) |
|
57 | + { |
|
55 | 58 | return new Autowire($this->config['handler']); |
56 | 59 | } |
57 | 60 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function __construct( |
15 | 15 | private readonly SessionInterface $session, |
16 | 16 | private readonly string $name |
17 | - ) { |
|
17 | + ){ |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public function get(string $name, mixed $default = null): mixed |
77 | 77 | { |
78 | - if (!$this->has($name)) { |
|
78 | + if (!$this->has($name)){ |
|
79 | 79 | return $default; |
80 | 80 | } |
81 | 81 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | $this->session->resume(); |
131 | 131 | |
132 | - if (!isset($_SESSION[$this->name])) { |
|
132 | + if (!isset($_SESSION[$this->name])){ |
|
133 | 133 | $_SESSION[$this->name] = []; |
134 | 134 | } |
135 | 135 | } |
@@ -75,7 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | public function get(string $name, mixed $default = null): mixed |
77 | 77 | { |
78 | - if (!$this->has($name)) { |
|
78 | + if (!$this->has($name)) |
|
79 | + { |
|
79 | 80 | return $default; |
80 | 81 | } |
81 | 82 | |
@@ -129,7 +130,8 @@ discard block |
||
129 | 130 | { |
130 | 131 | $this->session->resume(); |
131 | 132 | |
132 | - if (!isset($_SESSION[$this->name])) { |
|
133 | + if (!isset($_SESSION[$this->name])) |
|
134 | + { |
|
133 | 135 | $_SESSION[$this->name] = []; |
134 | 136 | } |
135 | 137 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | private readonly string $clientSignature, |
43 | 43 | private readonly int $lifetime, |
44 | 44 | string $id = null |
45 | - ) { |
|
46 | - if (!empty($id) && $this->validID($id)) { |
|
45 | + ){ |
|
46 | + if (!empty($id) && $this->validID($id)){ |
|
47 | 47 | $this->id = $id; |
48 | 48 | } |
49 | 49 | } |
@@ -65,24 +65,24 @@ discard block |
||
65 | 65 | |
66 | 66 | public function resume(): void |
67 | 67 | { |
68 | - if ($this->isStarted()) { |
|
68 | + if ($this->isStarted()){ |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | - if (!empty($this->id)) { |
|
72 | + if (!empty($this->id)){ |
|
73 | 73 | \session_id($this->id); |
74 | - } else { |
|
74 | + }else{ |
|
75 | 75 | // always new id |
76 | 76 | \session_id(\session_create_id()); |
77 | 77 | } |
78 | 78 | |
79 | - try { |
|
79 | + try{ |
|
80 | 80 | \session_start(['use_cookies' => false]); |
81 | - } catch (\Throwable $e) { |
|
82 | - throw new SessionException('Unable to start session', (int) $e->getCode(), $e); |
|
81 | + }catch (\Throwable $e){ |
|
82 | + throw new SessionException('Unable to start session', (int)$e->getCode(), $e); |
|
83 | 83 | } |
84 | 84 | |
85 | - if (empty($this->id)) { |
|
85 | + if (empty($this->id)){ |
|
86 | 86 | //Sign newly created session |
87 | 87 | $_SESSION[self::CLIENT_SIGNATURE] = $this->clientSignature; |
88 | 88 | $_SESSION[self::SESSION_CREATED] = \time(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->started = true; |
94 | 94 | |
95 | 95 | //Ensure that session is valid |
96 | - if (!$this->validSession()) { |
|
96 | + if (!$this->validSession()){ |
|
97 | 97 | $this->invalidateSession(); |
98 | 98 | } |
99 | 99 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | public function commit(): bool |
125 | 125 | { |
126 | - if (!$this->isStarted()) { |
|
126 | + if (!$this->isStarted()){ |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | public function abort(): bool |
137 | 137 | { |
138 | - if (!$this->isStarted()) { |
|
138 | + if (!$this->isStarted()){ |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | if ( |
172 | 172 | !\array_key_exists(self::CLIENT_SIGNATURE, $_SESSION) |
173 | 173 | || !\array_key_exists(self::SESSION_CREATED, $_SESSION) |
174 | - ) { |
|
174 | + ){ |
|
175 | 175 | //Missing session signature or timestamp! |
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | |
179 | - if ($_SESSION[self::SESSION_CREATED] < \time() - $this->lifetime) { |
|
179 | + if ($_SESSION[self::SESSION_CREATED] < \time() - $this->lifetime){ |
|
180 | 180 | //Session expired |
181 | 181 | return false; |
182 | 182 | } |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | private readonly int $lifetime, |
44 | 44 | string $id = null |
45 | 45 | ) { |
46 | - if (!empty($id) && $this->validID($id)) { |
|
46 | + if (!empty($id) && $this->validID($id)) |
|
47 | + { |
|
47 | 48 | $this->id = $id; |
48 | 49 | } |
49 | 50 | } |
@@ -65,24 +66,32 @@ discard block |
||
65 | 66 | |
66 | 67 | public function resume(): void |
67 | 68 | { |
68 | - if ($this->isStarted()) { |
|
69 | + if ($this->isStarted()) |
|
70 | + { |
|
69 | 71 | return; |
70 | 72 | } |
71 | 73 | |
72 | - if (!empty($this->id)) { |
|
74 | + if (!empty($this->id)) |
|
75 | + { |
|
73 | 76 | \session_id($this->id); |
74 | - } else { |
|
77 | + } |
|
78 | + else |
|
79 | + { |
|
75 | 80 | // always new id |
76 | 81 | \session_id(\session_create_id()); |
77 | 82 | } |
78 | 83 | |
79 | - try { |
|
84 | + try |
|
85 | + { |
|
80 | 86 | \session_start(['use_cookies' => false]); |
81 | - } catch (\Throwable $e) { |
|
87 | + } |
|
88 | + catch (\Throwable $e) |
|
89 | + { |
|
82 | 90 | throw new SessionException('Unable to start session', (int) $e->getCode(), $e); |
83 | 91 | } |
84 | 92 | |
85 | - if (empty($this->id)) { |
|
93 | + if (empty($this->id)) |
|
94 | + { |
|
86 | 95 | //Sign newly created session |
87 | 96 | $_SESSION[self::CLIENT_SIGNATURE] = $this->clientSignature; |
88 | 97 | $_SESSION[self::SESSION_CREATED] = \time(); |
@@ -93,7 +102,8 @@ discard block |
||
93 | 102 | $this->started = true; |
94 | 103 | |
95 | 104 | //Ensure that session is valid |
96 | - if (!$this->validSession()) { |
|
105 | + if (!$this->validSession()) |
|
106 | + { |
|
97 | 107 | $this->invalidateSession(); |
98 | 108 | } |
99 | 109 | } |
@@ -123,7 +133,8 @@ discard block |
||
123 | 133 | |
124 | 134 | public function commit(): bool |
125 | 135 | { |
126 | - if (!$this->isStarted()) { |
|
136 | + if (!$this->isStarted()) |
|
137 | + { |
|
127 | 138 | return false; |
128 | 139 | } |
129 | 140 | |
@@ -135,7 +146,8 @@ discard block |
||
135 | 146 | |
136 | 147 | public function abort(): bool |
137 | 148 | { |
138 | - if (!$this->isStarted()) { |
|
149 | + if (!$this->isStarted()) |
|
150 | + { |
|
139 | 151 | return false; |
140 | 152 | } |
141 | 153 | |
@@ -176,7 +188,8 @@ discard block |
||
176 | 188 | return false; |
177 | 189 | } |
178 | 190 | |
179 | - if ($_SESSION[self::SESSION_CREATED] < \time() - $this->lifetime) { |
|
191 | + if ($_SESSION[self::SESSION_CREATED] < \time() - $this->lifetime) |
|
192 | + { |
|
180 | 193 | //Session expired |
181 | 194 | return false; |
182 | 195 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function __construct( |
15 | 15 | private readonly FilesInterface $files, |
16 | 16 | private readonly string $directory |
17 | - ) { |
|
17 | + ){ |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function close(): bool |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function gc(int $maxlifetime): int |
37 | 37 | { |
38 | - foreach ($this->files->getFiles($this->directory) as $filename) { |
|
39 | - if ($this->files->time($filename) < \time() - $maxlifetime) { |
|
38 | + foreach ($this->files->getFiles($this->directory) as $filename){ |
|
39 | + if ($this->files->time($filename) < \time() - $maxlifetime){ |
|
40 | 40 | $this->files->delete($filename); |
41 | 41 | } |
42 | 42 | } |
@@ -35,8 +35,10 @@ |
||
35 | 35 | */ |
36 | 36 | public function gc(int $maxlifetime): int |
37 | 37 | { |
38 | - foreach ($this->files->getFiles($this->directory) as $filename) { |
|
39 | - if ($this->files->time($filename) < \time() - $maxlifetime) { |
|
38 | + foreach ($this->files->getFiles($this->directory) as $filename) |
|
39 | + { |
|
40 | + if ($this->files->time($filename) < \time() - $maxlifetime) |
|
41 | + { |
|
40 | 42 | $this->files->delete($filename); |
41 | 43 | } |
42 | 44 | } |