Completed
Push — master ( 634f9c...d18387 )
by Robin
04:16
created

Operator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 44
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2018 Robin Appelman <[email protected]>
4
 *
5
 * @license GNU AGPL version 3 or any later version
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Affero General Public License as
9
 * published by the Free Software Foundation, either version 3 of the
10
 * License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 */
21
22
namespace SearchDAV\Query;
23
24
class Operator {
25
	const OPERATION_AND = '{DAV:}and';
26
	const OPERATION_OR = '{DAV:}or';
27
	const OPERATION_NOT = '{DAV:}not';
28
	const OPERATION_EQUAL = '{DAV:}eq';
29
	const OPERATION_LESS_THAN = '{DAV:}lt';
30
	const OPERATION_LESS_OR_EQUAL_THAN = '{DAV:}lte';
31
	const OPERATION_GREATER_THAN = '{DAV:}gt';
32
	const OPERATION_GREATER_OR_EQUAL_THAN = '{DAV:}gte';
33
	const OPERATION_IS_COLLECTION = '{DAV:}is-collection';
34
	const OPERATION_IS_DEFINED = '{DAV:}is-defined';
35
	const OPERATION_IS_LIKE = '{DAV:}like';
36
	const OPERATION_CONTAINS = '{DAV:}contains';
37
38
	/**
39
	 * @var string
40
	 *
41
	 * The type of operation, one of the Operator::OPERATION_* constants
42
	 */
43
	public $type;
44
	/**
45
	 * @var (Literal|SearchPropDefinition|Operation)[]
46
	 *
47
	 * The list of arguments for the operation
48
	 *
49
	 *  - SearchPropDefinition: property for comparison
50
	 *  - Literal: literal value for comparison
51
	 *  - Operation: nested operation for and/or/not operations
52
	 *
53
	 * Which type and what number of argument an Operator takes depends on the operator type.
54
	 */
55
	public $arguments;
56
57
	/**
58
	 * Operator constructor.
59
	 *
60
	 * @param string $type
61
	 * @param array $arguments
62
	 */
63
	public function __construct($type = '', array $arguments = []) {
64
		$this->type = $type;
65
		$this->arguments = $arguments;
66
	}
67
}
68