MatchQuery::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
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