-
Notifications
You must be signed in to change notification settings - Fork 10
/
Holiday.php
206 lines (191 loc) · 4.4 KB
/
Holiday.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/**
* Holiday.php
*
* PHP Version 5
*
* Copyright (c) 1997-2008 The PHP Group
*
* This source file is subject to version 3.0 of the PHP license,
* that is bundled with this package in the file LICENSE, and is
* available at through the world-wide-web at
* http://www.php.net/license/3_01.txt.
* If you did not receive a copy of the PHP license and are unable to
* obtain it through the world-wide-web, please send a note to
* license@php.net so we can mail you a copy immediately.
*
* @category Date
* @package Date_Holidays
* @author Carsten Lucke <luckec@tool-garage.de>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
* @version CVS: $Id$
* @link http://pear.php.net/package/Date_Holidays
*/
/**
* Simple class that wraps a holiday's data
*
* @category Date
* @package Date_Holidays
* @author Carsten Lucke <luckec@tool-garage.de>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
* @version CVS: $Id$
* @link http://pear.php.net/package/Date_Holidays
*/
class Date_Holidays_Holiday
{
/**
* Internal name
*
* @access private
* @var string
*/
var $_internalName;
/**
* Title
*
* @access private
* @var string
*/
var $_title;
/**
* Date
*
* @access private
* @var object Date
*/
var $_date;
/**
* Additional holiday properties like a more detailed description, etc.
*
* @access private
* @var array
*/
var $_properties;
/**
* Constructor
*
* @param string $internalName internal name
* @param string $title title
* @param object &$date date
* @param array $properties properties for this holiday
*
* @access public
* @return void
*/
public function __construct($internalName, $title, &$date, $properties)
{
$this->_internalName = $internalName;
$this->_title = $title;
$this->_date = null;
$this->_properties = array();
if (is_a($date, 'Date')) {
$this->_date = $date;
}
if (is_array($properties)) {
$this->_properties = $properties;
}
}
/**
* Returns the internal name
*
* @access public
* @return string internal name
*/
function getInternalName()
{
return $this->_internalName;
}
/**
* Returns the title
*
* @access public
* @return string title
*/
function getTitle()
{
return $this->_title;
}
/**
* Returns the date
*
* @access public
* @return object Date date
*/
function getDate()
{
return $this->_date;
}
/**
* Set the internal name
*
* @param string $internalName internal name
*
* @access public
* @return void
*/
function setInternalName($internalName)
{
$this->_internalName = $internalName;
}
/**
* Set the title
*
* @param string $title title
*
* @access public
* @return void
*/
function setTitle($title)
{
$this->_title = $title;
}
/**
* Set the date
*
* @param object &$date date
*
* @access public
* @return void
*/
function setDate(&$date)
{
$this->_date = $date;
}
/**
* Returns the holiday data as an array.
*
* Format:
* <pre>
* array(
* 'internalName' => 'easter'
* 'title' => 'Easter Sunday'
* 'date' => Object of type Date
* )
* </pre>
*
* @access public
* @return array holiday-data
*/
function toArray()
{
$data = array();
$data['internalName'] = $this->_internalName;
$data['title'] = $this->_title;
$data['date'] = $this->_date;
return $data;
}
/**
* Returns the holidays additional properties that contain information
* like a more detailed description, etc.
*
* @access public
* @return array associative array with corresponding pairs
* of propertyName => $propertyValue
*/
function getProperties()
{
return $this->_properties;
}
}
?>