Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 40dd3a2

Browse files
fcabralpachecoOcramius
authored andcommitted
Fix phpcs violations.
1 parent a8be92d commit 40dd3a2

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

src/Response/SapiStreamEmitter.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ private function emitBody(ResponseInterface $response, $maxBufferLength)
6262
$body->rewind();
6363
}
6464

65-
if ($body->isReadable())
66-
{
67-
while (! $body->eof())
65+
if ($body->isReadable()) {
66+
while (! $body->eof()) {
6867
echo $body->read($maxBufferLength);
68+
}
6969
return;
7070
}
7171

@@ -92,16 +92,13 @@ private function emitBodyRange(array $range, ResponseInterface $response, $maxBu
9292
$first = 0;
9393
}
9494

95-
if ($body->isReadable())
96-
{
97-
for ($remaining = $length;
98-
($remaining >= $maxBufferLength) && (!$body->eof());
99-
$remaining -= strlen($contents)) {
95+
if ($body->isReadable()) {
96+
for ($remaining = $length; ($remaining >= $maxBufferLength)
97+
&& (! $body->eof()); $remaining -= strlen($contents)) {
10098
echo ($contents = $body->read($maxBufferLength));
101-
10299
}
103100

104-
if (($remaining > 0) && (!$body->eof())) {
101+
if (($remaining > 0) && (! $body->eof())) {
105102
echo $body->read($remaining);
106103
}
107104

test/Response/SapiStreamEmitterTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ public function testEmitBody($seekable, $contents, $maxBufferLength, $expectedRe
8383
$stream->isReadable()->willReturn(true);
8484
$stream->rewind()->willReturn(true);
8585

86-
$stream->eof()->will(function () use (&$contents, &$position){
87-
return !isset($contents[$position]);
86+
$stream->eof()->will(function () use (&$contents, &$position) {
87+
return ! isset($contents[$position]);
8888
});
8989

90-
$stream->read(Argument::type('integer'))->will(function ($args) use (&$contents, &$position){
90+
$stream->read(Argument::type('integer'))->will(function ($args) use (&$contents, &$position) {
9191
$data = substr($contents, $position, $args[0]);
9292
$position += strlen($data);
9393
return $data;
94-
});
94+
});
9595

9696
$response = (new Response())
9797
->withStatus(200)
@@ -102,7 +102,6 @@ public function testEmitBody($seekable, $contents, $maxBufferLength, $expectedRe
102102
$stream->rewind()->shouldBeCalledTimes($seekable ? 1 : 0);
103103
$stream->read(Argument::type('integer'))->shouldBeCalledTimes($expectedReads);
104104
$this->assertEquals($contents, ob_get_clean());
105-
106105
}
107106

108107
public function emitBodyRangeProvider()
@@ -128,16 +127,16 @@ public function testEmitBodyRange($seekable, $contents, $range, $maxBufferLength
128127
$stream->getSize()->willReturn(strlen($contents));
129128
$stream->isSeekable()->willReturn($seekable);
130129
$stream->isReadable()->willReturn(true);
131-
$stream->seek(Argument::type('integer'))->will(function ($args) use (&$position){
130+
$stream->seek(Argument::type('integer'))->will(function ($args) use (&$position) {
132131
$position = $args[0];
133132
return true;
134133
});
135134

136-
$stream->eof()->will(function () use (&$contents, &$position){
137-
return !isset($contents[$position]);
135+
$stream->eof()->will(function () use (&$contents, &$position) {
136+
return ! isset($contents[$position]);
138137
});
139138

140-
$stream->read(Argument::type('integer'))->will(function ($args) use (&$contents, &$position){
139+
$stream->read(Argument::type('integer'))->will(function ($args) use (&$contents, &$position) {
141140
$data = substr($contents, $position, $args[0]);
142141
$position += strlen($data);
143142
return $data;

0 commit comments

Comments
 (0)