Skip to content

Commit

Permalink
Merge pull request #111 from php-http/early-return
Browse files Browse the repository at this point in the history
cleanup code with early return
  • Loading branch information
dbu committed Mar 6, 2019
2 parents f7159b6 + 06dd957 commit c1f637c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Formatter/FullHttpMessageFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ private function addBody(MessageInterface $request, $message)
$stream = $request->getBody();
if (!$stream->isSeekable() || 0 === $this->maxBodyLength) {
// Do not read the stream
$message .= "\n";
} else {
$message .= "\n".mb_substr($stream->__toString(), 0, $this->maxBodyLength);
$stream->rewind();
return $message."\n";
}

$message .= "\n".mb_substr($stream->__toString(), 0, $this->maxBodyLength);
$stream->rewind();

return $message;
}
}

0 comments on commit c1f637c

Please sign in to comment.