Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Operator | |
100.00% |
6 / 6 |
|
100.00% |
2 / 2 |
5 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Finder\Output; |
| 6 | |
| 7 | use Cosray\Exception\ParserException; |
| 8 | use Cosray\Finder\Input\Token; |
| 9 | use Cosray\Finder\Input\TokenType; |
| 10 | |
| 11 | class Operator implements Output |
| 12 | { |
| 13 | public function __construct( |
| 14 | #[\SensitiveParameter] |
| 15 | public Token $token, |
| 16 | ) {} |
| 17 | |
| 18 | public function get(): string |
| 19 | { |
| 20 | return match ($this->token->type) { |
| 21 | TokenType::And => ' AND ', |
| 22 | TokenType::Or => ' OR ', |
| 23 | default => throw new ParserException('Invalid boolean operator'), |
| 24 | }; |
| 25 | } |
| 26 | } |