Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
75.00% covered (warning)
75.00%
3 / 4
CRAP
87.50% covered (warning)
87.50%
7 / 8
WildcardNode
0.00% covered (danger)
0.00%
0 / 1
75.00% covered (warning)
75.00%
3 / 4
4.03
87.50% covered (warning)
87.50%
7 / 8
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
 toArray
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getWildcardQuery
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 accept
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
namespace CirrusSearch\Parser\AST;
use CirrusSearch\Parser\AST\Visitor\Visitor;
/**
 * Wildcard query
 */
class WildcardNode extends ParsedNode {
    /**
     * @var string
     */
    private $wildcardQuery;
    /**
     * @param int $startOffset
     * @param int $endOffset
     * @param string $wildcard the wildcard query (should remain as written by the user)
     */
    public function __construct( $startOffset, $endOffset, $wildcard ) {
        parent::__construct( $startOffset, $endOffset );
        $this->wildcardQuery = $wildcard;
    }
    /**
     * @return array
     */
    public function toArray() {
        return [ 'wildcard' => array_merge( parent::baseParams(),
            [ 'wildcardquery' => $this->wildcardQuery ] ) ];
    }
    /**
     * The wildcard query.
     * Beware that it may contain potentially slow queries:
     * - leading wildcards
     * - non negligible number of wildcards
     * @return string
     */
    public function getWildcardQuery() {
        return $this->wildcardQuery;
    }
    /**
     * @param Visitor $visitor
     */
    public function accept( Visitor $visitor ) {
        $visitor->visitWildcardNode( $this );
    }
}