Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Response extends AbstractMessage implements ResponseInterface
public static function fromString($string)
{
$lines = explode("\r\n", $string);
if (!is_array($lines) || count($lines) == 1) {
if (!is_array($lines) || count($lines) === 1) {
$lines = explode("\n", $string);
}

Expand All @@ -190,15 +190,15 @@ public static function fromString($string)
$response->setStatusCode($matches['status']);
$response->setReasonPhrase((isset($matches['reason']) ? $matches['reason'] : ''));

if (count($lines) == 0) {
if (count($lines) === 0) {
return $response;
}

$isHeader = true;
$headers = $content = [];

foreach ($lines as $line) {
if ($isHeader && $line == '') {
if ($isHeader && $line === '') {
$isHeader = false;
continue;
}
Expand Down Expand Up @@ -338,7 +338,7 @@ public function getBody()
$transferEncoding = $this->getHeaders()->get('Transfer-Encoding');

if (!empty($transferEncoding)) {
if (strtolower($transferEncoding->getFieldValue()) == 'chunked') {
if (strtolower($transferEncoding->getFieldValue()) === 'chunked') {
$body = $this->decodeChunkedBody($body);
}
}
Expand All @@ -347,9 +347,9 @@ public function getBody()

if (!empty($contentEncoding)) {
$contentEncoding = $contentEncoding->getFieldValue();
if ($contentEncoding =='gzip') {
if ($contentEncoding === 'gzip') {
$body = $this->decodeGzip($body);
} elseif ($contentEncoding == 'deflate') {
} elseif ($contentEncoding === 'deflate') {
$body = $this->decodeDeflate($body);
}
}
Expand All @@ -375,7 +375,7 @@ public function isClientError()
*/
public function isForbidden()
{
return (403 == $this->getStatusCode());
return (403 === $this->getStatusCode());
}

/**
Expand Down Expand Up @@ -559,7 +559,7 @@ protected function decodeDeflate($body)
*/
$zlibHeader = unpack('n', substr($body, 0, 2));

if ($zlibHeader[1] % 31 == 0) {
if ($zlibHeader[1] % 31 === 0) {
return gzuncompress($body);
}
return gzinflate($body);
Expand Down