@@ -10,6 +10,6 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function __construct( |
| 12 | 12 | public readonly ServerRequestInterface $request |
| 13 | - ) { |
|
| 13 | + ){ |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -8,6 +8,6 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function __construct( |
| 10 | 10 | public readonly string $key, |
| 11 | - ) { |
|
| 11 | + ){ |
|
| 12 | 12 | } |
| 13 | 13 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $response = new Response($code); |
| 34 | 34 | $response = $response->withStatus($code, $reasonPhrase); |
| 35 | 35 | |
| 36 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 36 | + foreach ($this->config->getBaseHeaders() as $header => $value){ |
|
| 37 | 37 | $response = $response->withAddedHeader($header, $value); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | $response = new Response($code); |
| 34 | 34 | $response = $response->withStatus($code, $reasonPhrase); |
| 35 | 35 | |
| 36 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 36 | + foreach ($this->config->getBaseHeaders() as $header => $value) |
|
| 37 | + { |
|
| 37 | 38 | $response = $response->withAddedHeader($header, $value); |
| 38 | 39 | } |
| 39 | 40 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $response = new Response($code); |
| 34 | 34 | $response = $response->withStatus($code, $reasonPhrase); |
| 35 | 35 | |
| 36 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 36 | + foreach ($this->config->getBaseHeaders() as $header => $value){ |
|
| 37 | 37 | $response = $response->withAddedHeader($header, $value); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | $response = new Response($code); |
| 34 | 34 | $response = $response->withStatus($code, $reasonPhrase); |
| 35 | 35 | |
| 36 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 36 | + foreach ($this->config->getBaseHeaders() as $header => $value) |
|
| 37 | + { |
|
| 37 | 38 | $response = $response->withAddedHeader($header, $value); |
| 38 | 39 | } |
| 39 | 40 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | public function __construct( |
| 18 | 18 | private readonly Tokenizer $tokenizer |
| 19 | - ) { |
|
| 19 | + ){ |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $response = new Response($code); |
| 34 | 34 | $response = $response->withStatus($code, $reasonPhrase); |
| 35 | 35 | |
| 36 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 36 | + foreach ($this->config->getBaseHeaders() as $header => $value){ |
|
| 37 | 37 | $response = $response->withAddedHeader($header, $value); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | $response = new Response($code); |
| 34 | 34 | $response = $response->withStatus($code, $reasonPhrase); |
| 35 | 35 | |
| 36 | - foreach ($this->config->getBaseHeaders() as $header => $value) { |
|
| 36 | + foreach ($this->config->getBaseHeaders() as $header => $value) |
|
| 37 | + { |
|
| 37 | 38 | $response = $response->withAddedHeader($header, $value); |
| 38 | 39 | } |
| 39 | 40 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | return match (true) { |
| 25 | 25 | $string === $pattern => true, |
| 26 | 26 | !$this->isPattern($pattern) => false, |
| 27 | - default => (bool) \preg_match($this->getRegex($pattern), $string) |
|
| 27 | + default => (bool)\preg_match($this->getRegex($pattern), $string) |
|
| 28 | 28 | }; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function testIterate(): void |
| 26 | 26 | { |
| 27 | 27 | $out = ''; |
| 28 | - foreach ($this->buffer('abc') as $n) { |
|
| 28 | + foreach ($this->buffer('abc') as $n){ |
|
| 29 | 29 | $out .= $n->char; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | private function generate(StreamInterface $src) |
| 151 | 151 | { |
| 152 | - while (!$src->isEOI()) { |
|
| 152 | + while (!$src->isEOI()){ |
|
| 153 | 153 | yield new Byte($src->getOffset(), $src->peak()); |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | private function generateToken(StreamInterface $src): \Generator |
| 158 | 158 | { |
| 159 | - while (!$src->isEOI()) { |
|
| 159 | + while (!$src->isEOI()){ |
|
| 160 | 160 | yield new Token(0, null, $src->peak()); |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | public function testIterate(): void |
| 26 | 26 | { |
| 27 | 27 | $out = ''; |
| 28 | - foreach ($this->buffer('abc') as $n) { |
|
| 28 | + foreach ($this->buffer('abc') as $n) |
|
| 29 | + { |
|
| 29 | 30 | $out .= $n->char; |
| 30 | 31 | } |
| 31 | 32 | |
@@ -149,14 +150,16 @@ discard block |
||
| 149 | 150 | |
| 150 | 151 | private function generate(StreamInterface $src) |
| 151 | 152 | { |
| 152 | - while (!$src->isEOI()) { |
|
| 153 | + while (!$src->isEOI()) |
|
| 154 | + { |
|
| 153 | 155 | yield new Byte($src->getOffset(), $src->peak()); |
| 154 | 156 | } |
| 155 | 157 | } |
| 156 | 158 | |
| 157 | 159 | private function generateToken(StreamInterface $src): \Generator |
| 158 | 160 | { |
| 159 | - while (!$src->isEOI()) { |
|
| 161 | + while (!$src->isEOI()) |
|
| 162 | + { |
|
| 160 | 163 | yield new Token(0, null, $src->peak()); |
| 161 | 164 | } |
| 162 | 165 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** @internal */ |
| 20 | 20 | private readonly \Generator $generator, |
| 21 | 21 | private int $offset = 0 |
| 22 | - ) { |
|
| 22 | + ){ |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function getIterator(): \Traversable |
| 32 | 32 | { |
| 33 | - while ($n = $this->next()) { |
|
| 33 | + while ($n = $this->next()){ |
|
| 34 | 34 | yield $n; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -40,20 +40,20 @@ discard block |
||
| 40 | 40 | return $this->offset; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function next(): Byte|Token|null |
|
| 43 | + public function next(): Byte | Token | null |
|
| 44 | 44 | { |
| 45 | - if ($this->replay !== []) { |
|
| 45 | + if ($this->replay !== []){ |
|
| 46 | 46 | $n = \array_shift($this->replay); |
| 47 | - } else { |
|
| 47 | + }else{ |
|
| 48 | 48 | $n = $this->generator->current(); |
| 49 | - if ($n === null) { |
|
| 49 | + if ($n === null){ |
|
| 50 | 50 | return null; |
| 51 | 51 | } |
| 52 | 52 | $this->generator->next(); |
| 53 | 53 | $this->buffer[] = $n; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if ($n !== null && $n->offset !== null) { |
|
| 56 | + if ($n !== null && $n->offset !== null){ |
|
| 57 | 57 | $this->offset = $n->offset; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | public function nextBytes(): string |
| 67 | 67 | { |
| 68 | 68 | $result = ''; |
| 69 | - while ($n = $this->next()) { |
|
| 70 | - if ($n instanceof Byte) { |
|
| 69 | + while ($n = $this->next()){ |
|
| 70 | + if ($n instanceof Byte){ |
|
| 71 | 71 | $result .= $n->char; |
| 72 | - } else { |
|
| 72 | + }else{ |
|
| 73 | 73 | break; |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * Get next generator value without advancing the position. |
| 82 | 82 | */ |
| 83 | - public function lookahead(): Byte|Token|null |
|
| 83 | + public function lookahead(): Byte | Token | null |
|
| 84 | 84 | { |
| 85 | - if ($this->replay !== []) { |
|
| 85 | + if ($this->replay !== []){ |
|
| 86 | 86 | return $this->replay[0]; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $n = $this->next(); |
| 90 | - if ($n !== null) { |
|
| 90 | + if ($n !== null){ |
|
| 91 | 91 | \array_unshift($this->replay, $n); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -103,20 +103,20 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $result = ''; |
| 105 | 105 | $replay = []; |
| 106 | - for ($i = 0; $i < $size; $i++) { |
|
| 106 | + for ($i = 0; $i < $size; $i++){ |
|
| 107 | 107 | $n = $this->next(); |
| 108 | - if ($n !== null) { |
|
| 108 | + if ($n !== null){ |
|
| 109 | 109 | $replay[] = $n; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (!$n instanceof Byte) { |
|
| 112 | + if (!$n instanceof Byte){ |
|
| 113 | 113 | break; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $result .= $n->char; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - foreach (\array_reverse($replay) as $n) { |
|
| 119 | + foreach (\array_reverse($replay) as $n){ |
|
| 120 | 120 | \array_unshift($this->replay, $n); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function replay(int $offset): void |
| 130 | 130 | { |
| 131 | - foreach ($this->buffer as $n) { |
|
| 132 | - if ($n->offset > $offset) { |
|
| 131 | + foreach ($this->buffer as $n){ |
|
| 132 | + if ($n->offset > $offset){ |
|
| 133 | 133 | $this->replay[] = $n; |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -30,7 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function getIterator(): \Traversable |
| 32 | 32 | { |
| 33 | - while ($n = $this->next()) { |
|
| 33 | + while ($n = $this->next()) |
|
| 34 | + { |
|
| 34 | 35 | yield $n; |
| 35 | 36 | } |
| 36 | 37 | } |
@@ -42,18 +43,23 @@ discard block |
||
| 42 | 43 | |
| 43 | 44 | public function next(): Byte|Token|null |
| 44 | 45 | { |
| 45 | - if ($this->replay !== []) { |
|
| 46 | + if ($this->replay !== []) |
|
| 47 | + { |
|
| 46 | 48 | $n = \array_shift($this->replay); |
| 47 | - } else { |
|
| 49 | + } |
|
| 50 | + else |
|
| 51 | + { |
|
| 48 | 52 | $n = $this->generator->current(); |
| 49 | - if ($n === null) { |
|
| 53 | + if ($n === null) |
|
| 54 | + { |
|
| 50 | 55 | return null; |
| 51 | 56 | } |
| 52 | 57 | $this->generator->next(); |
| 53 | 58 | $this->buffer[] = $n; |
| 54 | 59 | } |
| 55 | 60 | |
| 56 | - if ($n !== null && $n->offset !== null) { |
|
| 61 | + if ($n !== null && $n->offset !== null) |
|
| 62 | + { |
|
| 57 | 63 | $this->offset = $n->offset; |
| 58 | 64 | } |
| 59 | 65 | |
@@ -66,10 +72,14 @@ discard block |
||
| 66 | 72 | public function nextBytes(): string |
| 67 | 73 | { |
| 68 | 74 | $result = ''; |
| 69 | - while ($n = $this->next()) { |
|
| 70 | - if ($n instanceof Byte) { |
|
| 75 | + while ($n = $this->next()) |
|
| 76 | + { |
|
| 77 | + if ($n instanceof Byte) |
|
| 78 | + { |
|
| 71 | 79 | $result .= $n->char; |
| 72 | - } else { |
|
| 80 | + } |
|
| 81 | + else |
|
| 82 | + { |
|
| 73 | 83 | break; |
| 74 | 84 | } |
| 75 | 85 | } |
@@ -82,12 +92,14 @@ discard block |
||
| 82 | 92 | */ |
| 83 | 93 | public function lookahead(): Byte|Token|null |
| 84 | 94 | { |
| 85 | - if ($this->replay !== []) { |
|
| 95 | + if ($this->replay !== []) |
|
| 96 | + { |
|
| 86 | 97 | return $this->replay[0]; |
| 87 | 98 | } |
| 88 | 99 | |
| 89 | 100 | $n = $this->next(); |
| 90 | - if ($n !== null) { |
|
| 101 | + if ($n !== null) |
|
| 102 | + { |
|
| 91 | 103 | \array_unshift($this->replay, $n); |
| 92 | 104 | } |
| 93 | 105 | |
@@ -103,20 +115,24 @@ discard block |
||
| 103 | 115 | { |
| 104 | 116 | $result = ''; |
| 105 | 117 | $replay = []; |
| 106 | - for ($i = 0; $i < $size; $i++) { |
|
| 118 | + for ($i = 0; $i < $size; $i++) |
|
| 119 | + { |
|
| 107 | 120 | $n = $this->next(); |
| 108 | - if ($n !== null) { |
|
| 121 | + if ($n !== null) |
|
| 122 | + { |
|
| 109 | 123 | $replay[] = $n; |
| 110 | 124 | } |
| 111 | 125 | |
| 112 | - if (!$n instanceof Byte) { |
|
| 126 | + if (!$n instanceof Byte) |
|
| 127 | + { |
|
| 113 | 128 | break; |
| 114 | 129 | } |
| 115 | 130 | |
| 116 | 131 | $result .= $n->char; |
| 117 | 132 | } |
| 118 | 133 | |
| 119 | - foreach (\array_reverse($replay) as $n) { |
|
| 134 | + foreach (\array_reverse($replay) as $n) |
|
| 135 | + { |
|
| 120 | 136 | \array_unshift($this->replay, $n); |
| 121 | 137 | } |
| 122 | 138 | |
@@ -128,8 +144,10 @@ discard block |
||
| 128 | 144 | */ |
| 129 | 145 | public function replay(int $offset): void |
| 130 | 146 | { |
| 131 | - foreach ($this->buffer as $n) { |
|
| 132 | - if ($n->offset > $offset) { |
|
| 147 | + foreach ($this->buffer as $n) |
|
| 148 | + { |
|
| 149 | + if ($n->offset > $offset) |
|
| 150 | + { |
|
| 133 | 151 | $this->replay[] = $n; |
| 134 | 152 | } |
| 135 | 153 | } |