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