From ff4ccd887473b398765a7b4af493ed796123e3cf Mon Sep 17 00:00:00 2001 From: Moath Date: Sat, 30 Oct 2021 17:46:55 +0300 Subject: [PATCH] make internal function private --- src/Jql.php | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Jql.php b/src/Jql.php index f7d470e..358f06e 100644 --- a/src/Jql.php +++ b/src/Jql.php @@ -4,6 +4,7 @@ namespace DevMoath\JqlBuilder; +use InvalidArgumentException; use Spatie\Macroable\Macroable; final class Jql implements \Stringable @@ -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)); @@ -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; @@ -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 + )); + } } }