MatchPhraseQuery   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A jsonSerialize() 0 3 1
A analyzer() 0 5 1
1
<?php
2
3
namespace olvlvl\ElasticsearchDSL\Query\Text;
4
5
use olvlvl\ElasticsearchDSL\Query\Helpers\JsonSerializeAsSimpleOrExtended;
6
use olvlvl\ElasticsearchDSL\Query\QueryAbstract;
7
8
class MatchPhraseQuery extends QueryAbstract
9
{
10
	use JsonSerializeAsSimpleOrExtended;
11
12
	const NAME = 'match_phrase';
13
14
	/**
15
	 * @var string
16
	 */
17
	private $field;
18
19
	/**
20
	 * @var string
21
	 */
22
	private $query;
23
24
	public function __construct(string $field, string $query)
25
	{
26
		$this->field = $field;
27
		$this->query = $query;
28
	}
29
30
	public function analyzer(?string $analyser)
31
	{
32
		$this->options[__FUNCTION__] = $analyser;
33
34
		return $this;
35
	}
36
37
	/**
38
	 * @inheritdoc
39
	 */
40
	public function jsonSerialize()
41
	{
42
		return $this->jsonSerializeAsSimpleOrExtended('query');
43
	}
44
}
45