MatchQuery   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 2

2 Methods

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