Skip to content

Commit

Permalink
Merge pull request #23 from KepplerPl/scrutinizer-patch-1
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
andrei-popa88 committed Jan 4, 2019
2 parents f1457ee + cab0225 commit 920d665
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 117 deletions.
26 changes: 13 additions & 13 deletions src/Builder/Schemes/Ftp/Bags/FtpMutablePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ public function prepend(string $value): self
*/
public function putInBetween(string $value, string $first = null, string $last = null): self
{
if(null === $first && null === $last) {
if (null === $first && null === $last) {
throw new \LogicException('Cannot put value if neither first or last is defined');
}

if(!$this->hasValueIn($this->path, $first) && !$this->hasValueIn($this->path, $last)) {
throw new ComponentNotFoundException(sprintf('No component found matching either %s %s',$first, $last));
if (!$this->hasValueIn($this->path, $first) && !$this->hasValueIn($this->path, $last)) {
throw new ComponentNotFoundException(sprintf('No component found matching either %s %s', $first, $last));
}

$this->mutatorPutInBetweenKeys($this->path, $value, $first, $last);
Expand All @@ -128,7 +128,7 @@ public function putInBetween(string $value, string $first = null, string $last =
*/
public function putBefore(string $before, string $value) : self
{
if(!$this->hasValueIn($this->path, $before)) {
if (!$this->hasValueIn($this->path, $before)) {
throw new \LogicException(sprintf('Cannot put value %s before %s as %s does not exist', $value, $before, $before));
}

Expand All @@ -146,7 +146,7 @@ public function putBefore(string $before, string $value) : self
*/
public function putAfter(string $after, string $value): self
{
if(!$this->hasValueIn($this->path, $after)) {
if (!$this->hasValueIn($this->path, $after)) {
throw new \LogicException(sprintf('Cannot put value %s after %s as %s does not exist', $value, $after, $after));
}

Expand All @@ -162,8 +162,8 @@ public function putAfter(string $after, string $value): self
*/
public function forget(string ...$args): self
{
foreach($args as $item) {
if(!$this->hasValueIn($this->path, $item)) {
foreach ($args as $item) {
if (!$this->hasValueIn($this->path, $item)) {
throw new \LogicException(sprintf('Cannot forget %s as it does not exist', $item));
}

Expand Down Expand Up @@ -232,13 +232,13 @@ public function all(): array
*/
public function raw(): string
{
if(empty($this->path)) {
if (empty($this->path)) {
return '';
}

$path = '/';
foreach($this->path as $element) {
$path .= $element . '/';
foreach ($this->path as $element) {
$path .= $element.'/';
}

return $path;
Expand All @@ -251,13 +251,13 @@ public function raw(): string
*/
public function encoded(): string
{
if(empty($this->path)) {
if (empty($this->path)) {
return '';
}

$path = '/';
foreach($this->path as $element) {
$path .= urlencode($element) . '/';
foreach ($this->path as $element) {
$path .= urlencode($element).'/';
}

return $path;
Expand Down
6 changes: 3 additions & 3 deletions src/Builder/Schemes/Ftp/FtpBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct(FtpImmutable $ftp = null)
{
$this->pathBag = new FtpMutablePath();

if(null !== $ftp) {
if (null !== $ftp) {
$this->populate($ftp);

$this->user = $ftp->getUser();
Expand Down Expand Up @@ -270,9 +270,9 @@ public function build(bool $urlEncode = false): string

$url = self::SCHEME.'://';

if ( ! empty($this->user)) {
if (!empty($this->user)) {
$url .= $this->user;
if ( ! empty($this->password)) {
if (!empty($this->password)) {
$url .= ':'.$this->password;
}

Expand Down
26 changes: 13 additions & 13 deletions src/Builder/Schemes/Http/Bags/HttpMutablePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ public function prepend(string $value): self
*/
public function putInBetween(string $value, string $first = null, string $last = null): self
{
if(null === $first && null === $last) {
if (null === $first && null === $last) {
throw new \LogicException('Cannot put value if neither first or last is defined');
}

if(!$this->hasValueIn($this->path, $first) && !$this->hasValueIn($this->path, $last)) {
throw new ComponentNotFoundException(sprintf('No component found matching either %s %s',$first, $last));
if (!$this->hasValueIn($this->path, $first) && !$this->hasValueIn($this->path, $last)) {
throw new ComponentNotFoundException(sprintf('No component found matching either %s %s', $first, $last));
}

$this->mutatorPutInBetweenKeys($this->path, $value, $first, $last);
Expand All @@ -128,7 +128,7 @@ public function putInBetween(string $value, string $first = null, string $last =
*/
public function putBefore(string $before, string $value) : self
{
if(!$this->hasValueIn($this->path, $before)) {
if (!$this->hasValueIn($this->path, $before)) {
throw new \LogicException(sprintf('Cannot put value %s before %s as %s does not exist', $value, $before, $before));
}

Expand All @@ -146,7 +146,7 @@ public function putBefore(string $before, string $value) : self
*/
public function putAfter(string $after, string $value): self
{
if(!$this->hasValueIn($this->path, $after)) {
if (!$this->hasValueIn($this->path, $after)) {
throw new \LogicException(sprintf('Cannot put value %s after %s as %s does not exist', $value, $after, $after));
}

Expand All @@ -162,8 +162,8 @@ public function putAfter(string $after, string $value): self
*/
public function forget(string ...$args): self
{
foreach($args as $item) {
if(!$this->hasValueIn($this->path, $item)) {
foreach ($args as $item) {
if (!$this->hasValueIn($this->path, $item)) {
throw new \LogicException(sprintf('Cannot forget %s as it does not exist', $item));
}

Expand Down Expand Up @@ -232,13 +232,13 @@ public function all(): array
*/
public function raw(): string
{
if(empty($this->path)) {
if (empty($this->path)) {
return '';
}

$path = '/';
foreach($this->path as $element) {
$path .= $element . '/';
foreach ($this->path as $element) {
$path .= $element.'/';
}

return $path;
Expand All @@ -251,13 +251,13 @@ public function raw(): string
*/
public function encoded(): string
{
if(empty($this->path)) {
if (empty($this->path)) {
return '';
}

$path = '/';
foreach($this->path as $element) {
$path .= urlencode($element) . '/';
foreach ($this->path as $element) {
$path .= urlencode($element).'/';
}

return $path;
Expand Down
6 changes: 3 additions & 3 deletions src/Builder/Schemes/Http/Bags/HttpMutableQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function last(): ?array
public function forget(string ...$args): self
{
foreach ($args as $item) {
if ( ! $this->hasValueIn($this->query, $item)) {
if (!$this->hasValueIn($this->query, $item)) {
throw new \LogicException(sprintf('Cannot forget %s as it does not exist',
$item));
}
Expand Down Expand Up @@ -130,7 +130,7 @@ public function all(): array
*/
public function raw(): string
{
if ( ! empty($this->query)) {
if (!empty($this->query)) {
return '?'.urldecode(http_build_query($this->query));
}

Expand All @@ -144,7 +144,7 @@ public function raw(): string
*/
public function encoded(): string
{
if ( ! empty($this->query)) {
if (!empty($this->query)) {
return '?'.http_build_query($this->query);
}

Expand Down
10 changes: 5 additions & 5 deletions src/Builder/Schemes/Http/HttpBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function __construct(HttpImmutable $http = null)
$this->pathBag = new HttpMutablePath();
$this->queryBag = new HttpMutableQuery();

if(null !== $http) {
if (null !== $http) {
$this->populate($http);

$this->authority = $http->getAuthority();
Expand Down Expand Up @@ -149,15 +149,15 @@ private function buildAuthority(): void
{
$authority = '';

if ( ! empty($this->user)) {
if (!empty($this->user)) {
$authority .= $this->user;
}

if ( ! empty($this->password)) {
if (!empty($this->password)) {
$authority .= ':'.$this->password;
}

if ( ! empty($this->host)) {
if (!empty($this->host)) {
$authority .= '@'.$this->host;
}

Expand Down Expand Up @@ -336,7 +336,7 @@ public function build(bool $urlEncode = false): string
$url .= $this->queryBag->raw();
}

if ( ! empty($this->fragment)) {
if (!empty($this->fragment)) {
$url .= '#'.$this->fragment;
}

Expand Down
26 changes: 13 additions & 13 deletions src/Builder/Schemes/Https/Bags/HttpsMutablePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ public function prepend(string $value): self
*/
public function putInBetween(string $value, string $first = null, string $last = null): self
{
if(null === $first && null === $last) {
if (null === $first && null === $last) {
throw new \LogicException('Cannot put value if neither first or last is defined');
}

if(!$this->hasValueIn($this->path, $first) && !$this->hasValueIn($this->path, $last)) {
throw new ComponentNotFoundException(sprintf('No component found matching either %s %s',$first, $last));
if (!$this->hasValueIn($this->path, $first) && !$this->hasValueIn($this->path, $last)) {
throw new ComponentNotFoundException(sprintf('No component found matching either %s %s', $first, $last));
}

$this->mutatorPutInBetweenKeys($this->path, $value, $first, $last);
Expand All @@ -128,7 +128,7 @@ public function putInBetween(string $value, string $first = null, string $last =
*/
public function putBefore(string $before, string $value) : self
{
if(!$this->hasValueIn($this->path, $before)) {
if (!$this->hasValueIn($this->path, $before)) {
throw new \LogicException(sprintf('Cannot put value %s before %s as %s does not exist', $value, $before, $before));
}

Expand All @@ -146,7 +146,7 @@ public function putBefore(string $before, string $value) : self
*/
public function putAfter(string $after, string $value): self
{
if(!$this->hasValueIn($this->path, $after)) {
if (!$this->hasValueIn($this->path, $after)) {
throw new \LogicException(sprintf('Cannot put value %s after %s as %s does not exist', $value, $after, $after));
}

Expand All @@ -162,8 +162,8 @@ public function putAfter(string $after, string $value): self
*/
public function forget(string ...$args): self
{
foreach($args as $item) {
if(!$this->hasValueIn($this->path, $item)) {
foreach ($args as $item) {
if (!$this->hasValueIn($this->path, $item)) {
throw new \LogicException(sprintf('Cannot forget %s as it does not exist', $item));
}

Expand Down Expand Up @@ -232,13 +232,13 @@ public function all(): array
*/
public function raw(): string
{
if(empty($this->path)) {
if (empty($this->path)) {
return '';
}

$path = '/';
foreach($this->path as $element) {
$path .= $element . '/';
foreach ($this->path as $element) {
$path .= $element.'/';
}

return $path;
Expand All @@ -251,13 +251,13 @@ public function raw(): string
*/
public function encoded(): string
{
if(empty($this->path)) {
if (empty($this->path)) {
return '';
}

$path = '/';
foreach($this->path as $element) {
$path .= urlencode($element) . '/';
foreach ($this->path as $element) {
$path .= urlencode($element).'/';
}

return $path;
Expand Down
6 changes: 3 additions & 3 deletions src/Builder/Schemes/Https/Bags/HttpsMutableQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function last()
public function forget(string ...$args): self
{
foreach ($args as $item) {
if ( ! $this->hasValueIn($this->query, $item)) {
if (!$this->hasValueIn($this->query, $item)) {
throw new \LogicException(sprintf('Cannot forget %s as it does not exist',
$item));
}
Expand Down Expand Up @@ -129,7 +129,7 @@ public function all(): array
*/
public function raw(): string
{
if ( ! empty($this->query)) {
if (!empty($this->query)) {
return '?'.urldecode(http_build_query($this->query));
}

Expand All @@ -143,7 +143,7 @@ public function raw(): string
*/
public function encoded(): string
{
if ( ! empty($this->query)) {
if (!empty($this->query)) {
return '?'.http_build_query($this->query);
}

Expand Down
10 changes: 5 additions & 5 deletions src/Builder/Schemes/Https/HttpsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function __construct(HttpsImmutable $https = null)
{
$this->pathBag = new HttpsMutablePath();
$this->queryBag = new HttpsMutableQuery();
if(null !== $https) {
if (null !== $https) {
$this->populate($https);

$this->authority = $https->getAuthority();
Expand Down Expand Up @@ -148,15 +148,15 @@ private function buildAuthority(): void
{
$authority = '';

if ( ! empty($this->user)) {
if (!empty($this->user)) {
$authority .= $this->user;
}

if ( ! empty($this->password)) {
if (!empty($this->password)) {
$authority .= ':'.$this->password;
}

if ( ! empty($this->host)) {
if (!empty($this->host)) {
$authority .= '@'.$this->host;
}

Expand Down Expand Up @@ -335,7 +335,7 @@ public function build(bool $urlEncode = false): string
$url .= $this->queryBag->raw();
}

if ( ! empty($this->fragment)) {
if (!empty($this->fragment)) {
$url .= '#'.$this->fragment;
}

Expand Down

0 comments on commit 920d665

Please sign in to comment.