RegexpQuery   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A max_determinized_states() 0 5 1
A __construct() 0 4 1
A flags() 0 5 1
1
<?php
2
3
namespace olvlvl\ElasticsearchDSL\Query\Term;
4
5
use olvlvl\ElasticsearchDSL\Query\Helpers\JsonSerializeAsSimpleOrExtended;
6
use olvlvl\ElasticsearchDSL\Query\Option\BoostOption;
7
use olvlvl\ElasticsearchDSL\Query\Option\HasBoostOption;
8
use olvlvl\ElasticsearchDSL\Query\QueryAbstract;
9
10
/**
11
 * @property string|null $flags
12
 * @property int|null $max_determinized_states
13
 *
14
 * @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl-regexp-query.html
15
 */
16
class RegexpQuery extends QueryAbstract implements HasBoostOption
17
{
18
	use BoostOption;
19
	use JsonSerializeAsSimpleOrExtended {
20
		jsonSerializeAsSimpleOrExtended as public jsonSerialize;
21
	}
22
23
	const NAME = 'regexp';
24
25
	/**
26
	 * @var string
27
	 */
28
	private $field;
29
30
	/**
31
	 * @var mixed
32
	 */
33
	private $value;
34
35
	public function __construct(string $field, $value)
36
	{
37
		$this->field = $field;
38
		$this->value = $value;
39
	}
40
41
	public function flags(?string $flags)
42
	{
43
		$this->options[__FUNCTION__] = $flags;
44
45
		return $this;
46
	}
47
48
	public function max_determinized_states(?int $max_determinized_states)
49
	{
50
		$this->options[__FUNCTION__] = $max_determinized_states;
51
52
		return $this;
53
	}
54
}
55