Completed
Push — master ( c0d232...67b20e )
by Olivier
43:39 queued 05:10
created

QueryCollection::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace olvlvl\ElasticsearchDSL\Query;
4
5
use olvlvl\ElasticsearchDSL\Helpers;
6
7
class QueryCollection implements
8
	HasTextQueries,
9
	HasTermQueries,
10
	HasCompoundQueries,
11
	HasJoiningQueries,
12
	\JsonSerializable
13
{
14
	use TextQueries;
15
	use TermQueries;
16
	use CompoundQueries;
17
	use JoiningQueries;
18
19
	/**
20
	 * @inheritdoc
21
	 */
22
	public function __toString()
23
	{
24
		return json_encode($this, JSON_PRETTY_PRINT);
25
	}
26
27
	/**
28
	 * @inheritdoc
29
	 */
30
	public function jsonSerialize()
31
	{
32
		return Helpers::merge_and_prefer_single(
33
			$this->jsonSerializeTextQueries(),
34
			$this->jsonSerializeTermQueries(),
35
			$this->jsonSerializeCompoundQueries(),
36
			$this->jsonSerializeJoiningQueries()
37
		);
38
	}
39
}
40