Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
88.89% |
8 / 9 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| WordsQueryNode | |
88.89% |
8 / 9 |
|
75.00% |
3 / 4 |
4.02 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| getWords | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| accept | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace CirrusSearch\Parser\AST; |
| 4 | |
| 5 | use CirrusSearch\Parser\AST\Visitor\Visitor; |
| 6 | |
| 7 | /** |
| 8 | * Simple query node made of words. |
| 9 | */ |
| 10 | class WordsQueryNode extends ParsedNode { |
| 11 | |
| 12 | /** |
| 13 | * @var string |
| 14 | */ |
| 15 | private $words; |
| 16 | |
| 17 | /** |
| 18 | * @param int $startOffset |
| 19 | * @param int $endOffset |
| 20 | * @param string $words |
| 21 | */ |
| 22 | public function __construct( $startOffset, $endOffset, $words ) { |
| 23 | parent::__construct( $startOffset, $endOffset ); |
| 24 | $this->words = $words; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * @return array |
| 29 | */ |
| 30 | public function toArray() { |
| 31 | return [ |
| 32 | 'words' => array_merge( parent::baseParams(), [ |
| 33 | 'words' => $this->words |
| 34 | ] ) |
| 35 | ]; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @return string |
| 40 | */ |
| 41 | public function getWords() { |
| 42 | return $this->words; |
| 43 | } |
| 44 | |
| 45 | public function accept( Visitor $visitor ) { |
| 46 | $visitor->visitWordsQueryNode( $this ); |
| 47 | } |
| 48 | } |