Skip to content

Commit e27f1be

Browse files
authored
Merge pull request #91 from php-http/analysis-XZB590
Apply fixes from StyleCI
2 parents 2df55de + d61a93d commit e27f1be

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/Plugin/AddHostPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class AddHostPlugin implements Plugin
3333
*/
3434
public function __construct(UriInterface $host, array $config = [])
3535
{
36-
if ($host->getHost() === '') {
36+
if ('' === $host->getHost()) {
3737
throw new \LogicException('Host can not be empty');
3838
}
3939

@@ -51,7 +51,7 @@ public function __construct(UriInterface $host, array $config = [])
5151
*/
5252
public function handleRequest(RequestInterface $request, callable $next, callable $first)
5353
{
54-
if ($this->replace || $request->getUri()->getHost() === '') {
54+
if ($this->replace || '' === $request->getUri()->getHost()) {
5555
$uri = $request->getUri()
5656
->withHost($this->host->getHost())
5757
->withScheme($this->host->getScheme())

src/Plugin/AddPathPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ final class AddPathPlugin implements Plugin
2323
*/
2424
public function __construct(UriInterface $uri)
2525
{
26-
if ($uri->getPath() === '') {
26+
if ('' === $uri->getPath()) {
2727
throw new \LogicException('URI path cannot be empty');
2828
}
2929

30-
if (substr($uri->getPath(), -1) === '/') {
30+
if ('/' === substr($uri->getPath(), -1)) {
3131
throw new \LogicException('URI path cannot end with a slash.');
3232
}
3333

src/Plugin/ContentTypePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private function isJson($stream)
102102

103103
json_decode($stream->getContents());
104104

105-
return json_last_error() == JSON_ERROR_NONE;
105+
return JSON_ERROR_NONE == json_last_error();
106106
}
107107

108108
/**

src/Plugin/CookiePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
5151
continue;
5252
}
5353

54-
if ($cookie->isSecure() && ($request->getUri()->getScheme() !== 'https')) {
54+
if ($cookie->isSecure() && ('https' !== $request->getUri()->getScheme())) {
5555
continue;
5656
}
5757

src/Plugin/DecoderPlugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ private function decodeOnEncodingHeader($headerName, ResponseInterface $response
123123
*/
124124
private function decorateStream($encoding, StreamInterface $stream)
125125
{
126-
if (strtolower($encoding) == 'chunked') {
126+
if ('chunked' == strtolower($encoding)) {
127127
return new Encoding\DechunkStream($stream);
128128
}
129129

130-
if (strtolower($encoding) == 'deflate') {
130+
if ('deflate' == strtolower($encoding)) {
131131
return new Encoding\DecompressStream($stream);
132132
}
133133

134-
if (strtolower($encoding) == 'gzip') {
134+
if ('gzip' == strtolower($encoding)) {
135135
return new Encoding\GzipDecodeStream($stream);
136136
}
137137

0 commit comments

Comments
 (0)