@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | $kernel->addDispatcher($factory->make(SapiDispatcher::class)); |
83 | 83 | }); |
84 | 84 | |
85 | - if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher')) { |
|
86 | - if (class_exists(PSR7Client::class)) { |
|
85 | + if (!class_exists('Spiral\RoadRunnerBridge\Http\Dispatcher')){ |
|
86 | + if (class_exists(PSR7Client::class)){ |
|
87 | 87 | $kernel->addDispatcher($factory->make(LegacyRrDispatcher::class)); |
88 | 88 | } |
89 | 89 | |
90 | - if (class_exists(PSR7Worker::class)) { |
|
90 | + if (class_exists(PSR7Worker::class)){ |
|
91 | 91 | $kernel->addDispatcher($factory->make(RrDispatcher::class)); |
92 | 92 | } |
93 | 93 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | $emitter = new SapiEmitter(); |
133 | 133 | |
134 | - if (($chunkSize = $config->getChunkSize()) !== null) { |
|
134 | + if (($chunkSize = $config->getChunkSize()) !== null){ |
|
135 | 135 | $emitter->bufferSize = $chunkSize; |
136 | 136 | } |
137 | 137 |
@@ -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 | } |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | private function emitBody(ResponseInterface $response): void |
55 | 55 | { |
56 | 56 | $body = $response->getBody(); |
57 | - if ($body->isSeekable()) { |
|
57 | + if ($body->isSeekable()){ |
|
58 | 58 | $body->rewind(); |
59 | 59 | } |
60 | - if (!$body->isReadable()) { |
|
60 | + if (!$body->isReadable()){ |
|
61 | 61 | return; |
62 | 62 | } |
63 | - if ($this->bufferSize === 0) { |
|
63 | + if ($this->bufferSize === 0){ |
|
64 | 64 | echo $body; |
65 | 65 | } |
66 | - while (!$body->eof()) { |
|
66 | + while (!$body->eof()){ |
|
67 | 67 | echo $body->read($this->bufferSize); |
68 | 68 | flush(); |
69 | 69 | } |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | private function assertNoPreviousOutput(): void |
82 | 82 | { |
83 | - if (headers_sent()) { |
|
83 | + if (headers_sent()){ |
|
84 | 84 | throw new EmitterException('Unable to emit response, headers already send.'); |
85 | 85 | } |
86 | 86 | |
87 | - if (ob_get_level() > 0 && ob_get_length() > 0) { |
|
87 | + if (ob_get_level() > 0 && ob_get_length() > 0){ |
|
88 | 88 | throw new EmitterException('Unable to emit response, found non closed buffered output.'); |
89 | 89 | } |
90 | 90 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'HTTP/%s %d%s', |
111 | 111 | $response->getProtocolVersion(), |
112 | 112 | $statusCode, |
113 | - ($reasonPhrase ? ' ' . $reasonPhrase : '') |
|
113 | + ($reasonPhrase ? ' '.$reasonPhrase : '') |
|
114 | 114 | ), true, $statusCode); |
115 | 115 | } |
116 | 116 | |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | { |
129 | 129 | $statusCode = $response->getStatusCode(); |
130 | 130 | |
131 | - foreach ($response->getHeaders() as $header => $values) { |
|
131 | + foreach ($response->getHeaders() as $header => $values){ |
|
132 | 132 | $name = $this->filterHeader($header); |
133 | 133 | $first = $name === 'Set-Cookie' ? false : true; |
134 | - foreach ($values as $value) { |
|
134 | + foreach ($values as $value){ |
|
135 | 135 | header(sprintf( |
136 | 136 | '%s: %s', |
137 | 137 | $name, |