1
|
|
|
<?php namespace CalDAVClient\Facade\Requests; |
2
|
|
|
/** |
3
|
|
|
* Copyright 2017 OpenStack Foundation |
4
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
5
|
|
|
* you may not use this file except in compliance with the License. |
6
|
|
|
* You may obtain a copy of the License at |
7
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
* Unless required by applicable law or agreed to in writing, software |
9
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
10
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
11
|
|
|
* See the License for the specific language governing permissions and |
12
|
|
|
* limitations under the License. |
13
|
|
|
**/ |
14
|
|
|
use DateTime; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class CalendarQueryFilter |
18
|
|
|
* @package CalDAVClient\Facade\Requests |
19
|
|
|
*/ |
20
|
|
|
final class CalendarQueryFilter |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var bool |
24
|
|
|
*/ |
25
|
|
|
private $get_etags; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var bool |
29
|
|
|
*/ |
30
|
|
|
private $get_calendar_data; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var DateTime |
34
|
|
|
*/ |
35
|
|
|
private $to; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var DateTime |
39
|
|
|
*/ |
40
|
|
|
private $from; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* CalendarQueryFilter constructor. |
44
|
|
|
* @param bool $get_etags |
45
|
|
|
* @param bool $get_calendar_data |
46
|
|
|
* @param DateTime $from |
47
|
|
|
* @param DateTime $to |
48
|
|
|
*/ |
49
|
|
|
public function __construct($get_etags = true, $get_calendar_data = false, DateTime $from = null, DateTime $to = null) |
50
|
|
|
{ |
51
|
|
|
$this->get_etags = $get_etags; |
52
|
|
|
$this->get_calendar_data = $get_calendar_data; |
53
|
|
|
$this->from = $from; |
54
|
|
|
$this->to = $to; |
55
|
|
|
|
56
|
|
|
if(!is_null($this->from) && !is_null($this->to) && $this->from > $this->to) |
57
|
|
|
throw new \InvalidArgumentException("from should be lower than to param"); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return bool |
62
|
|
|
*/ |
63
|
|
|
public function useGetETags() |
64
|
|
|
{ |
65
|
|
|
return $this->get_etags; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return bool |
70
|
|
|
*/ |
71
|
|
|
public function useGetCalendarData() |
72
|
|
|
{ |
73
|
|
|
return $this->get_calendar_data; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return DateTime |
78
|
|
|
*/ |
79
|
|
|
public function getTo() |
80
|
|
|
{ |
81
|
|
|
return $this->to; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return DateTime |
86
|
|
|
*/ |
87
|
|
|
public function getFrom() |
88
|
|
|
{ |
89
|
|
|
return $this->from; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
} |