From d61a93df83668562a63acf3666e716a9956f55dd Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Wed, 22 Nov 2017 19:58:40 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Plugin/AddHostPlugin.php | 4 ++-- src/Plugin/AddPathPlugin.php | 4 ++-- src/Plugin/ContentTypePlugin.php | 2 +- src/Plugin/CookiePlugin.php | 2 +- src/Plugin/DecoderPlugin.php | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Plugin/AddHostPlugin.php b/src/Plugin/AddHostPlugin.php index 9e35de2..29ab8ae 100644 --- a/src/Plugin/AddHostPlugin.php +++ b/src/Plugin/AddHostPlugin.php @@ -33,7 +33,7 @@ final class AddHostPlugin implements Plugin */ public function __construct(UriInterface $host, array $config = []) { - if ($host->getHost() === '') { + if ('' === $host->getHost()) { throw new \LogicException('Host can not be empty'); } @@ -51,7 +51,7 @@ public function __construct(UriInterface $host, array $config = []) */ public function handleRequest(RequestInterface $request, callable $next, callable $first) { - if ($this->replace || $request->getUri()->getHost() === '') { + if ($this->replace || '' === $request->getUri()->getHost()) { $uri = $request->getUri() ->withHost($this->host->getHost()) ->withScheme($this->host->getScheme()) diff --git a/src/Plugin/AddPathPlugin.php b/src/Plugin/AddPathPlugin.php index 18fdf52..e24d61a 100644 --- a/src/Plugin/AddPathPlugin.php +++ b/src/Plugin/AddPathPlugin.php @@ -23,11 +23,11 @@ final class AddPathPlugin implements Plugin */ public function __construct(UriInterface $uri) { - if ($uri->getPath() === '') { + if ('' === $uri->getPath()) { throw new \LogicException('URI path cannot be empty'); } - if (substr($uri->getPath(), -1) === '/') { + if ('/' === substr($uri->getPath(), -1)) { throw new \LogicException('URI path cannot end with a slash.'); } diff --git a/src/Plugin/ContentTypePlugin.php b/src/Plugin/ContentTypePlugin.php index 038b3e4..2390ca6 100644 --- a/src/Plugin/ContentTypePlugin.php +++ b/src/Plugin/ContentTypePlugin.php @@ -102,7 +102,7 @@ private function isJson($stream) json_decode($stream->getContents()); - return json_last_error() == JSON_ERROR_NONE; + return JSON_ERROR_NONE == json_last_error(); } /** diff --git a/src/Plugin/CookiePlugin.php b/src/Plugin/CookiePlugin.php index c6cd36f..59ee90d 100644 --- a/src/Plugin/CookiePlugin.php +++ b/src/Plugin/CookiePlugin.php @@ -51,7 +51,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl continue; } - if ($cookie->isSecure() && ($request->getUri()->getScheme() !== 'https')) { + if ($cookie->isSecure() && ('https' !== $request->getUri()->getScheme())) { continue; } diff --git a/src/Plugin/DecoderPlugin.php b/src/Plugin/DecoderPlugin.php index 7666c64..4b924a4 100644 --- a/src/Plugin/DecoderPlugin.php +++ b/src/Plugin/DecoderPlugin.php @@ -123,15 +123,15 @@ private function decodeOnEncodingHeader($headerName, ResponseInterface $response */ private function decorateStream($encoding, StreamInterface $stream) { - if (strtolower($encoding) == 'chunked') { + if ('chunked' == strtolower($encoding)) { return new Encoding\DechunkStream($stream); } - if (strtolower($encoding) == 'deflate') { + if ('deflate' == strtolower($encoding)) { return new Encoding\DecompressStream($stream); } - if (strtolower($encoding) == 'gzip') { + if ('gzip' == strtolower($encoding)) { return new Encoding\GzipDecodeStream($stream); }