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

QueryCollection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A jsonSerialize() 0 7 1
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