Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Operator
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 get
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Finder\Output;
6
7use Cosray\Exception\ParserException;
8use Cosray\Finder\Input\Token;
9use Cosray\Finder\Input\TokenType;
10
11class 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}