IdsQuery   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 7
c 1
b 0
f 0
dl 0
loc 35
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A type() 0 5 1
A jsonSerialize() 0 3 1
1
<?php
2
3
namespace olvlvl\ElasticsearchDSL\Query\Term;
4
5
use olvlvl\ElasticsearchDSL\Query\QueryAbstract;
6
7
/**
8
 * @property string|null $type
9
 */
10
class IdsQuery extends QueryAbstract
11
{
12
	const NAME = 'ids';
13
14
	/**
15
	 * @var array
16
	 */
17
	private $values;
18
19
	/**
20
	 * @param array $values
21
	 */
22
	public function __construct(array $values)
23
	{
24
		$this->values = $values;
25
	}
26
27
	/**
28
	 * @param string|null $type
29
	 *
30
	 * @return $this
31
	 */
32
	public function type(?string $type)
33
	{
34
		$this->options[__FUNCTION__] = $type;
35
36
		return $this;
37
	}
38
39
	/**
40
	 * @inheritdoc
41
	 */
42
	public function jsonSerialize()
43
	{
44
		return [ self::NAME => [ 'values' => $this->values ] + parent::jsonSerialize() ];
45
	}
46
}
47