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
|
|
|
|
15
|
|
|
use DateTimeZone; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Class MakeCalendarRequestVO |
19
|
|
|
* @package CalDAVClient\Facade\Requests |
20
|
|
|
*/ |
21
|
|
|
final class MakeCalendarRequestVO |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
private $uid; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var DateTimeZone |
30
|
|
|
*/ |
31
|
|
|
private $timezone; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
private $resource_name; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var null|string |
40
|
|
|
*/ |
41
|
|
|
private $display_name; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var null|string |
45
|
|
|
*/ |
46
|
|
|
private $description; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* MakeCalendarRequestDTO constructor. |
50
|
|
|
* @param string $resource_name |
51
|
|
|
* @param string|null $display_name |
52
|
|
|
* @param string|null $description |
53
|
|
|
* @param DateTimeZone|null $timezone |
54
|
|
|
*/ |
55
|
|
|
public function __construct($resource_name, $display_name = null, $description = null, DateTimeZone $timezone = null) |
56
|
|
|
{ |
57
|
|
|
$this->resource_name = strtolower($resource_name); |
58
|
|
|
$this->display_name = $display_name; |
59
|
|
|
$this->description = $description; |
60
|
|
|
$this->timezone = $timezone; |
61
|
|
|
$this->uid = md5(uniqid(mt_rand(), true)); |
62
|
|
|
|
63
|
|
|
if(is_null($this->timezone)){ |
64
|
|
|
$this->timezone = new DateTimeZone('UTC'); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param string $uid |
70
|
|
|
*/ |
71
|
|
|
public function setUID($uid){ |
72
|
|
|
$this->uid = $uid; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
|
|
public function getUID() |
79
|
|
|
{ |
80
|
|
|
return $this->uid; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return DateTimeZone |
85
|
|
|
*/ |
86
|
|
|
public function getTimezone() |
87
|
|
|
{ |
88
|
|
|
return $this->timezone; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return string |
93
|
|
|
*/ |
94
|
|
|
public function getResourceName() |
95
|
|
|
{ |
96
|
|
|
return $this->resource_name; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return null|string |
101
|
|
|
*/ |
102
|
|
|
public function getDisplayName() |
103
|
|
|
{ |
104
|
|
|
return $this->display_name; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return null|string |
109
|
|
|
*/ |
110
|
|
|
public function getDescription() |
111
|
|
|
{ |
112
|
|
|
return $this->description; |
113
|
|
|
} |
114
|
|
|
} |