Skip to content

Commit

Permalink
make internal function private
Browse files Browse the repository at this point in the history
  • Loading branch information
devmoath committed Oct 30, 2021
1 parent a014e3a commit ff4ccd8
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/Jql.php
Expand Up @@ -4,6 +4,7 @@

namespace DevMoath\JqlBuilder;

use InvalidArgumentException;
use Spatie\Macroable\Macroable;

final class Jql implements \Stringable
Expand Down Expand Up @@ -86,21 +87,6 @@ public function quote(string $operator, mixed $value): string
return "'$value'";
}

/**
* @throws \InvalidArgumentException
*/
public function invalidBoolean(mixed $boolean): void
{
if (! in_array($boolean, [self::AND, self::OR])) {
throw new \InvalidArgumentException(sprintf(
"Illegal boolean [%s] value. only [%s, %s] is acceptable",
$boolean,
self::AND,
self::OR
));
}
}

public function whereProject(mixed $value, string $operator = self::EQUAL): self
{
return tap($this, fn() => $this->where('project', $operator, $value));
Expand Down Expand Up @@ -171,7 +157,12 @@ public function getQuery(): string
return trim($this->query);
}

public function appendQuery(string $query, string $boolean = ''): void
public function __toString(): string
{
return $this->getQuery();
}

private function appendQuery(string $query, string $boolean = ''): void
{
if (empty($this->query)) {
$this->query = $query;
Expand All @@ -180,8 +171,18 @@ public function appendQuery(string $query, string $boolean = ''): void
}
}

public function __toString(): string
/**
* @throws \InvalidArgumentException
*/
private function invalidBoolean(mixed $boolean): void
{
return $this->getQuery();
if (! in_array($boolean, [self::AND, self::OR])) {
throw new InvalidArgumentException(sprintf(
"Illegal boolean [%s] value. only [%s, %s] is acceptable",
$boolean,
self::AND,
self::OR
));
}
}
}

0 comments on commit ff4ccd8

Please sign in to comment.