Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
4 / 5 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| PrefixNode | |
80.00% |
4 / 5 |
|
75.00% |
3 / 4 |
4.13 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getPrefix | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| accept | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php declare( strict_types=1 ); |
| 2 | |
| 3 | namespace CirrusSearch\Parser\AST; |
| 4 | |
| 5 | use CirrusSearch\Parser\AST\Visitor\Visitor; |
| 6 | |
| 7 | /** |
| 8 | * A simple word prefix query |
| 9 | */ |
| 10 | class PrefixNode extends ParsedNode { |
| 11 | |
| 12 | private string $prefix; |
| 13 | |
| 14 | public function __construct( int $startOffset, int $endOffset, string $prefix ) { |
| 15 | parent::__construct( $startOffset, $endOffset ); |
| 16 | $this->prefix = $prefix; |
| 17 | } |
| 18 | |
| 19 | public function getPrefix(): string { |
| 20 | return $this->prefix; |
| 21 | } |
| 22 | |
| 23 | public function toArray(): array { |
| 24 | return [ 'prefix' => array_merge( parent::baseParams(), [ 'prefix' => $this->prefix ] ) ]; |
| 25 | } |
| 26 | |
| 27 | public function accept( Visitor $visitor ): void { |
| 28 | $visitor->visitPrefixNode( $this ); |
| 29 | } |
| 30 | |
| 31 | } |