@@ -63,6 +63,10 @@ |
||
63 | 63 | * |
64 | 64 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
65 | 65 | */ |
66 | + |
|
67 | + /** |
|
68 | + * @param \DateTime $date_time |
|
69 | + */ |
|
66 | 70 | public function __construct( $date_time = NULL ) { |
67 | 71 | |
68 | 72 | if ( $date_time !== NULL ) { |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | |
116 | 116 | $this->temp_day = 0; |
117 | 117 | |
118 | - for ( $i = 1 ; $i < $this->month ; $i++ ) { |
|
118 | + for ( $i = 1 ; $i < $this->month ; $i++ ) { |
|
119 | 119 | |
120 | - $this->temp_day += $this->config['gregorian_month_days'][$i]; |
|
120 | + $this->temp_day += $this->config['gregorian_month_days'][$i]; |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - $this->temp_day += $this->day; |
|
124 | + $this->temp_day += $this->day; |
|
125 | 125 | |
126 | - $this->leap = new leap( $this->year ); |
|
126 | + $this->leap = new leap( $this->year ); |
|
127 | 127 | |
128 | - if( $this->leap->get() && $this->month > 2 ) $this->temp_day++; |
|
128 | + if( $this->leap->get() && $this->month > 2 ) $this->temp_day++; |
|
129 | 129 | |
130 | - if ( $this->temp_day <= 79 ) { |
|
130 | + if ( $this->temp_day <= 79 ) { |
|
131 | 131 | |
132 | 132 | if( ( $this->year - 1 ) % 4 == 0 ) |
133 | 133 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | - } |
|
158 | + } |
|
159 | 159 | |
160 | - else { |
|
160 | + else { |
|
161 | 161 | |
162 | 162 | $this->year = $this->year - 621; |
163 | 163 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | |
204 | 204 | } |
205 | 205 | |
206 | - } |
|
206 | + } |
|
207 | 207 | |
208 | - $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
208 | + $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
209 | 209 | |
210 | - return $this->date_time; |
|
210 | + return $this->date_time; |
|
211 | 211 | |
212 | 212 | } |
213 | 213 | |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | |
237 | 237 | } |
238 | 238 | |
239 | - $this->temp_day += $this->day; |
|
239 | + $this->temp_day += $this->day; |
|
240 | 240 | |
241 | - $this->leap = new leap( $this->year ); |
|
241 | + $this->leap = new leap( $this->year ); |
|
242 | 242 | |
243 | 243 | if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
244 | 244 | |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | |
251 | 251 | $_month = $_year[1]; |
252 | 252 | |
253 | - $var_temp = '0.0'; |
|
253 | + $var_temp = '0.0'; |
|
254 | 254 | |
255 | 255 | for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
256 | 256 | |
257 | 257 | $var_temp .= '0'; |
258 | 258 | |
259 | - } |
|
259 | + } |
|
260 | 260 | |
261 | - $var_temp .= '1'; |
|
261 | + $var_temp .= '1'; |
|
262 | 262 | |
263 | 263 | $_month = $_month * $var_temp ; |
264 | 264 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
276 | 276 | |
277 | - $var_temp .= '0' ; |
|
277 | + $var_temp .= '0' ; |
|
278 | 278 | |
279 | 279 | } |
280 | 280 | |
@@ -288,18 +288,18 @@ discard block |
||
288 | 288 | |
289 | 289 | $this->day = $_day[0]; |
290 | 290 | |
291 | - $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
291 | + $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
292 | 292 | |
293 | 293 | |
294 | - return $this->date_time; |
|
294 | + return $this->date_time; |
|
295 | 295 | |
296 | - } |
|
296 | + } |
|
297 | 297 | |
298 | 298 | /** |
299 | - *convert shamsi year to gregorian year |
|
300 | - * @since Oct, 16 2015 |
|
301 | - * @return object |
|
302 | - */ |
|
299 | + *convert shamsi year to gregorian year |
|
300 | + * @since Oct, 16 2015 |
|
301 | + * @return object |
|
302 | + */ |
|
303 | 303 | public function shamsiToGregorian( $date_time ) { |
304 | 304 | |
305 | 305 | $this->date_time = $date_time; |
@@ -356,15 +356,15 @@ discard block |
||
356 | 356 | $this->date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
357 | 357 | |
358 | 358 | |
359 | - return $this->date_time; |
|
359 | + return $this->date_time; |
|
360 | 360 | |
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | - *convert shamsi year to ghamari year |
|
365 | - * @since Oct, 17 2015 |
|
366 | - * @return object |
|
367 | - */ |
|
364 | + *convert shamsi year to ghamari year |
|
365 | + * @since Oct, 17 2015 |
|
366 | + * @return object |
|
367 | + */ |
|
368 | 368 | public function shamsiToGhamari( $date_time ) { |
369 | 369 | |
370 | 370 | $this->date_time = $date_time; |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | |
384 | 384 | } |
385 | 385 | |
386 | - $this->temp_day += $this->day; |
|
386 | + $this->temp_day += $this->day; |
|
387 | 387 | |
388 | - $this->leap = new leap( $this->year ); |
|
388 | + $this->leap = new leap( $this->year ); |
|
389 | 389 | |
390 | 390 | if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
391 | 391 | |
@@ -397,15 +397,15 @@ discard block |
||
397 | 397 | |
398 | 398 | $_month = $_year[1]; |
399 | 399 | |
400 | - $var_temp = '0.0'; |
|
400 | + $var_temp = '0.0'; |
|
401 | 401 | |
402 | 402 | for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
403 | 403 | |
404 | 404 | $var_temp .= '0'; |
405 | 405 | |
406 | - } |
|
406 | + } |
|
407 | 407 | |
408 | - $var_temp .= '1'; |
|
408 | + $var_temp .= '1'; |
|
409 | 409 | |
410 | 410 | $_month = $_month * $var_temp ; |
411 | 411 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
423 | 423 | |
424 | - $var_temp .= '0' ; |
|
424 | + $var_temp .= '0' ; |
|
425 | 425 | |
426 | 426 | } |
427 | 427 | |
@@ -435,17 +435,17 @@ discard block |
||
435 | 435 | |
436 | 436 | $this->day = $_day[0]; |
437 | 437 | |
438 | - $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
438 | + $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
439 | 439 | |
440 | - return $this->date_time; |
|
440 | + return $this->date_time; |
|
441 | 441 | |
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
445 | - *convert ghamari year to shamsi year |
|
446 | - * @since Oct, 17 2015 |
|
447 | - * @return object |
|
448 | - */ |
|
445 | + *convert ghamari year to shamsi year |
|
446 | + * @since Oct, 17 2015 |
|
447 | + * @return object |
|
448 | + */ |
|
449 | 449 | public function ghamariToShamsi( $date_time ) { |
450 | 450 | |
451 | 451 | $this->date_time = $date_time; |
@@ -491,15 +491,15 @@ discard block |
||
491 | 491 | |
492 | 492 | $this->date_time->setDate( $shamsi_year, $shamsi_month, $shamsi_day ); |
493 | 493 | |
494 | - return $this->date_time; |
|
494 | + return $this->date_time; |
|
495 | 495 | |
496 | 496 | } |
497 | 497 | |
498 | 498 | /** |
499 | - * convert ghamari year to gregorian year |
|
500 | - * @since Oct, 17 2015 |
|
501 | - * @return object |
|
502 | - */ |
|
499 | + * convert ghamari year to gregorian year |
|
500 | + * @since Oct, 17 2015 |
|
501 | + * @return object |
|
502 | + */ |
|
503 | 503 | public function ghamariToGregorian( $date_time ) { |
504 | 504 | |
505 | 505 | $this->date_time = $date_time; |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | |
546 | 546 | $this->date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
547 | 547 | |
548 | - return $this->date_time; |
|
548 | + return $this->date_time; |
|
549 | 549 | |
550 | 550 | } |
551 | 551 |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | * |
64 | 64 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
65 | 65 | */ |
66 | - public function __construct( $date_time = NULL ) { |
|
66 | + public function __construct($date_time = NULL) { |
|
67 | 67 | |
68 | - if ( $date_time !== NULL ) { |
|
68 | + if ($date_time !== NULL) { |
|
69 | 69 | |
70 | 70 | $this->date_time = $date_time; |
71 | 71 | |
72 | 72 | } |
73 | 73 | |
74 | - $this->config = include( 'Config.php' ); |
|
74 | + $this->config = include('Config.php'); |
|
75 | 75 | |
76 | 76 | $this->persian_month = $this->config['month']['persian']; |
77 | 77 | |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | * |
86 | 86 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
87 | 87 | */ |
88 | - public function to( $calendar ) { |
|
88 | + public function to($calendar) { |
|
89 | 89 | |
90 | - $this->calendar_file = include( 'CalendarSettings/' . ucfirst( $calendar ) . '.php' ); |
|
90 | + $this->calendar_file = include('CalendarSettings/'.ucfirst($calendar).'.php'); |
|
91 | 91 | |
92 | - return $this->calendar_file[ 'convert_to' ]( $this->date_time ); |
|
92 | + return $this->calendar_file['convert_to']($this->date_time); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 | |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | * |
104 | 104 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
105 | 105 | */ |
106 | - public function gregorianToShamsi( $date_time ) { |
|
106 | + public function gregorianToShamsi($date_time) { |
|
107 | 107 | |
108 | 108 | $this->date_time = $date_time; |
109 | 109 | |
110 | - $this->year = $this->date_time->format( 'Y' ); |
|
110 | + $this->year = $this->date_time->format('Y'); |
|
111 | 111 | |
112 | - $this->month = $this->date_time->format( 'm' ); |
|
112 | + $this->month = $this->date_time->format('m'); |
|
113 | 113 | |
114 | - $this->day = $this->date_time->format( 'd' ); |
|
114 | + $this->day = $this->date_time->format('d'); |
|
115 | 115 | |
116 | 116 | $this->temp_day = 0; |
117 | 117 | |
118 | - for ( $i = 1 ; $i < $this->month ; $i++ ) { |
|
118 | + for ($i = 1; $i < $this->month; $i++) { |
|
119 | 119 | |
120 | 120 | $this->temp_day += $this->config['gregorian_month_days'][$i]; |
121 | 121 | |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | |
124 | 124 | $this->temp_day += $this->day; |
125 | 125 | |
126 | - $this->leap = new leap( $this->year ); |
|
126 | + $this->leap = new leap($this->year); |
|
127 | 127 | |
128 | - if( $this->leap->get() && $this->month > 2 ) $this->temp_day++; |
|
128 | + if ($this->leap->get() && $this->month > 2) $this->temp_day++; |
|
129 | 129 | |
130 | - if ( $this->temp_day <= 79 ) { |
|
130 | + if ($this->temp_day <= 79) { |
|
131 | 131 | |
132 | - if( ( $this->year - 1 ) % 4 == 0 ) |
|
132 | + if (($this->year - 1) % 4 == 0) |
|
133 | 133 | |
134 | 134 | $this->temp_day = $this->temp_day + 11; |
135 | 135 | |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | |
140 | 140 | $this->year = $this->year - 622; |
141 | 141 | |
142 | - if($this->temp_day % 30 == 0) { |
|
142 | + if ($this->temp_day % 30 == 0) { |
|
143 | 143 | |
144 | - $this->month = ( $this->temp_day / 30 ) + 9; |
|
144 | + $this->month = ($this->temp_day / 30) + 9; |
|
145 | 145 | |
146 | 146 | $this->day = 30; |
147 | 147 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | else { |
151 | 151 | |
152 | - $this->month = ( $this->temp_day / 30 ) + 10; |
|
152 | + $this->month = ($this->temp_day / 30) + 10; |
|
153 | 153 | |
154 | 154 | $this->day = $this->temp_day % 30; |
155 | 155 | |
@@ -163,20 +163,20 @@ discard block |
||
163 | 163 | |
164 | 164 | $this->temp_day = $this->temp_day - 79; |
165 | 165 | |
166 | - if( $this->temp_day <= 186 ) { |
|
166 | + if ($this->temp_day <= 186) { |
|
167 | 167 | |
168 | - if( $this->temp_day % 31 == 0 ) { |
|
168 | + if ($this->temp_day % 31 == 0) { |
|
169 | 169 | |
170 | - $this->month = ( $this->temp_day / 31 ); |
|
170 | + $this->month = ($this->temp_day / 31); |
|
171 | 171 | |
172 | 172 | $this->day = 31; |
173 | 173 | } |
174 | 174 | |
175 | 175 | else { |
176 | 176 | |
177 | - $this->month = ( $this->temp_day / 31 ) + 1; |
|
177 | + $this->month = ($this->temp_day / 31) + 1; |
|
178 | 178 | |
179 | - $this->day = ( $this->temp_day % 31 ); |
|
179 | + $this->day = ($this->temp_day % 31); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | } |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | |
186 | 186 | $this->temp_day = $this->temp_day - 186; |
187 | 187 | |
188 | - if( $this->temp_day % 30 == 0 ) { |
|
188 | + if ($this->temp_day % 30 == 0) { |
|
189 | 189 | |
190 | - $this->month = ( $this->temp_day / 30 ) + 6; |
|
190 | + $this->month = ($this->temp_day / 30) + 6; |
|
191 | 191 | |
192 | 192 | $this->day = 30; |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | else { |
197 | 197 | |
198 | - $this->month = ( $this->temp_day / 30 ) + 7; |
|
198 | + $this->month = ($this->temp_day / 30) + 7; |
|
199 | 199 | |
200 | 200 | $this->day = $this->temp_day % 30; |
201 | 201 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | } |
207 | 207 | |
208 | - $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
208 | + $this->date_time->setDate($this->year, $this->month, $this->day); |
|
209 | 209 | |
210 | 210 | return $this->date_time; |
211 | 211 | |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | * @since Aug, 29 2015 |
217 | 217 | * @return object |
218 | 218 | */ |
219 | - public function gregorianToGhamari( $date_time ) { |
|
219 | + public function gregorianToGhamari($date_time) { |
|
220 | 220 | |
221 | 221 | $this->date_time = $date_time; |
222 | 222 | |
223 | - $this->date_time = $this->gregorianToShamsi( $this->date_time ); |
|
223 | + $this->date_time = $this->gregorianToShamsi($this->date_time); |
|
224 | 224 | |
225 | 225 | $this->year = $this->date_time->format('Y'); |
226 | 226 | |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | |
229 | 229 | $this->day = $this->date_time->format('d'); |
230 | 230 | |
231 | - $this->temp_day = 0 ; |
|
231 | + $this->temp_day = 0; |
|
232 | 232 | |
233 | - for ( $i = 1 ; $i < $this->month ; $i++ ) { |
|
233 | + for ($i = 1; $i < $this->month; $i++) { |
|
234 | 234 | |
235 | 235 | $this->temp_day += $this->config['shamsi_month_days'][$i]; |
236 | 236 | |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | |
239 | 239 | $this->temp_day += $this->day; |
240 | 240 | |
241 | - $this->leap = new leap( $this->year ); |
|
241 | + $this->leap = new leap($this->year); |
|
242 | 242 | |
243 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
243 | + if ($this->leap->get() && $this->month > 11) $this->temp_day++; |
|
244 | 244 | |
245 | - $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
|
245 | + $_year = ((((($this->year - 1) * 365.2422) + $this->temp_day) - 119) / 354.3670) + 1; |
|
246 | 246 | |
247 | - $_year = explode( '.', $_year ); |
|
247 | + $_year = explode('.', $_year); |
|
248 | 248 | |
249 | 249 | $this->year = $_year[0]; |
250 | 250 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | $var_temp = '0.0'; |
254 | 254 | |
255 | - for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
255 | + for ($i = strlen($_month); $i > 2; $i--) { |
|
256 | 256 | |
257 | 257 | $var_temp .= '0'; |
258 | 258 | |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | |
261 | 261 | $var_temp .= '1'; |
262 | 262 | |
263 | - $_month = $_month * $var_temp ; |
|
263 | + $_month = $_month * $var_temp; |
|
264 | 264 | |
265 | - $_month = ( $_month * 12 ) + 1; |
|
265 | + $_month = ($_month * 12) + 1; |
|
266 | 266 | |
267 | - $_month = explode( '.', $_month ); |
|
267 | + $_month = explode('.', $_month); |
|
268 | 268 | |
269 | 269 | $this->month = $_month[0]; |
270 | 270 | |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | |
273 | 273 | $var_temp = '0.0'; |
274 | 274 | |
275 | - for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
275 | + for ($i = strlen($_day); $i > 2; $i--) { |
|
276 | 276 | |
277 | - $var_temp .= '0' ; |
|
277 | + $var_temp .= '0'; |
|
278 | 278 | |
279 | 279 | } |
280 | 280 | |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | |
283 | 283 | $_day = $_day * $var_temp; |
284 | 284 | |
285 | - $_day = ( $_day * 29.530 ); |
|
285 | + $_day = ($_day * 29.530); |
|
286 | 286 | |
287 | - $_day = explode( '.', $_day ); |
|
287 | + $_day = explode('.', $_day); |
|
288 | 288 | |
289 | 289 | $this->day = $_day[0]; |
290 | 290 | |
291 | - $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
291 | + $this->date_time->setDate($this->year, $this->month, $this->day); |
|
292 | 292 | |
293 | 293 | |
294 | 294 | return $this->date_time; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @since Oct, 16 2015 |
301 | 301 | * @return object |
302 | 302 | */ |
303 | -public function shamsiToGregorian( $date_time ) { |
|
303 | +public function shamsiToGregorian($date_time) { |
|
304 | 304 | |
305 | 305 | $this->date_time = $date_time; |
306 | 306 | |
@@ -312,39 +312,39 @@ discard block |
||
312 | 312 | |
313 | 313 | $days_of_year = 0; |
314 | 314 | |
315 | -foreach ( $this->config['shamsi_month_days'] as $month => $value ) { |
|
315 | +foreach ($this->config['shamsi_month_days'] as $month => $value) { |
|
316 | 316 | |
317 | - if( $this->month > $month ) $days_of_year += $value; |
|
317 | + if ($this->month > $month) $days_of_year += $value; |
|
318 | 318 | |
319 | 319 | } |
320 | 320 | |
321 | 321 | $days_of_year += $this->day; |
322 | 322 | |
323 | -$days_of_leap_years = intval( ( ( $this->year - 1 ) / 4 ) ); |
|
323 | +$days_of_leap_years = intval((($this->year - 1) / 4)); |
|
324 | 324 | |
325 | -$days_of_shamsi_years = ( ( ( $this->year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years ); |
|
325 | +$days_of_shamsi_years = ((($this->year - 1) * 365) + $days_of_year + $days_of_leap_years); |
|
326 | 326 | |
327 | 327 | $days_of_gregorain_years = $days_of_shamsi_years + 226899; |
328 | 328 | |
329 | -if ( $this->month < 10 ) { |
|
329 | +if ($this->month < 10) { |
|
330 | 330 | |
331 | -$days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 621 ) / 4 ) ); |
|
331 | +$days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 621) / 4)); |
|
332 | 332 | |
333 | 333 | } |
334 | 334 | |
335 | -elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
335 | +elseif (((10 == $this->month) && ($this->day > 10)) || ($this->month > 10)) { |
|
336 | 336 | |
337 | -$days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 622 ) / 4 ) ); |
|
337 | +$days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 622) / 4)); |
|
338 | 338 | |
339 | 339 | } |
340 | 340 | |
341 | -$gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
341 | +$gregorian_month = ($days_of_gregorain_years % 365); |
|
342 | 342 | |
343 | -$gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
343 | +$gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
|
344 | 344 | |
345 | 345 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
346 | 346 | |
347 | - if ( $gregorian_month < $value ) break; |
|
347 | + if ($gregorian_month < $value) break; |
|
348 | 348 | |
349 | 349 | $gregorian_month -= $value; |
350 | 350 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | $gregorian_month = $month; |
355 | 355 | |
356 | - $this->date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
356 | + $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
|
357 | 357 | |
358 | 358 | |
359 | 359 | return $this->date_time; |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @since Oct, 17 2015 |
366 | 366 | * @return object |
367 | 367 | */ |
368 | -public function shamsiToGhamari( $date_time ) { |
|
368 | +public function shamsiToGhamari($date_time) { |
|
369 | 369 | |
370 | 370 | $this->date_time = $date_time; |
371 | 371 | |
@@ -375,9 +375,9 @@ discard block |
||
375 | 375 | |
376 | 376 | $this->day = $this->date_time->format('d'); |
377 | 377 | |
378 | - $this->temp_day = 0 ; |
|
378 | + $this->temp_day = 0; |
|
379 | 379 | |
380 | - for ( $i = 1 ; $i < $this->month ; $i++ ) { |
|
380 | + for ($i = 1; $i < $this->month; $i++) { |
|
381 | 381 | |
382 | 382 | $this->temp_day += $this->config['shamsi_month_days'][$i]; |
383 | 383 | |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | |
386 | 386 | $this->temp_day += $this->day; |
387 | 387 | |
388 | - $this->leap = new leap( $this->year ); |
|
388 | + $this->leap = new leap($this->year); |
|
389 | 389 | |
390 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
390 | + if ($this->leap->get() && $this->month > 11) $this->temp_day++; |
|
391 | 391 | |
392 | - $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
|
392 | + $_year = ((((($this->year - 1) * 365.2422) + $this->temp_day) - 119) / 354.3670) + 1; |
|
393 | 393 | |
394 | - $_year = explode( '.', $_year ); |
|
394 | + $_year = explode('.', $_year); |
|
395 | 395 | |
396 | 396 | $this->year = $_year[0]; |
397 | 397 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | $var_temp = '0.0'; |
401 | 401 | |
402 | - for ( $i = strlen( $_month ); $i > 2; $i-- ) { |
|
402 | + for ($i = strlen($_month); $i > 2; $i--) { |
|
403 | 403 | |
404 | 404 | $var_temp .= '0'; |
405 | 405 | |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | |
408 | 408 | $var_temp .= '1'; |
409 | 409 | |
410 | - $_month = $_month * $var_temp ; |
|
410 | + $_month = $_month * $var_temp; |
|
411 | 411 | |
412 | - $_month = ( $_month * 12 ) + 1; |
|
412 | + $_month = ($_month * 12) + 1; |
|
413 | 413 | |
414 | - $_month = explode( '.', $_month ); |
|
414 | + $_month = explode('.', $_month); |
|
415 | 415 | |
416 | 416 | $this->month = $_month[0]; |
417 | 417 | |
@@ -419,9 +419,9 @@ discard block |
||
419 | 419 | |
420 | 420 | $var_temp = '0.0'; |
421 | 421 | |
422 | - for ( $i = strlen( $_day ); $i > 2; $i-- ) { |
|
422 | + for ($i = strlen($_day); $i > 2; $i--) { |
|
423 | 423 | |
424 | - $var_temp .= '0' ; |
|
424 | + $var_temp .= '0'; |
|
425 | 425 | |
426 | 426 | } |
427 | 427 | |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | |
430 | 430 | $_day = $_day * $var_temp; |
431 | 431 | |
432 | - $_day = ( $_day * 29.530 ); |
|
432 | + $_day = ($_day * 29.530); |
|
433 | 433 | |
434 | - $_day = explode( '.', $_day ); |
|
434 | + $_day = explode('.', $_day); |
|
435 | 435 | |
436 | 436 | $this->day = $_day[0]; |
437 | 437 | |
438 | - $this->date_time->setDate( $this->year, $this->month, $this->day ); |
|
438 | + $this->date_time->setDate($this->year, $this->month, $this->day); |
|
439 | 439 | |
440 | 440 | return $this->date_time; |
441 | 441 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | * @since Oct, 17 2015 |
447 | 447 | * @return object |
448 | 448 | */ |
449 | -public function ghamariToShamsi( $date_time ) { |
|
449 | +public function ghamariToShamsi($date_time) { |
|
450 | 450 | |
451 | 451 | $this->date_time = $date_time; |
452 | 452 | |
@@ -458,29 +458,29 @@ discard block |
||
458 | 458 | |
459 | 459 | $days_of_year = 0; |
460 | 460 | |
461 | -foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
|
461 | +foreach ($this->config['islamic_month_days'] as $month => $value) { |
|
462 | 462 | |
463 | - if( $this->month > $month ) $days_of_year += $value; |
|
463 | + if ($this->month > $month) $days_of_year += $value; |
|
464 | 464 | |
465 | 465 | } |
466 | 466 | |
467 | 467 | $days_of_year += $this->day; |
468 | 468 | |
469 | -$days_of_leap_years = intval( ( ( $this->year - 1 ) / 3 ) ); |
|
469 | +$days_of_leap_years = intval((($this->year - 1) / 3)); |
|
470 | 470 | |
471 | -$days_of_ghamari_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
471 | +$days_of_ghamari_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
472 | 472 | |
473 | 473 | $days_of_shamsi_years = $days_of_ghamari_years + 179; |
474 | 474 | |
475 | -$days_of_shamsi_years = $days_of_shamsi_years - intval( ( ( $this->year - 43 ) / 4 ) ); |
|
475 | +$days_of_shamsi_years = $days_of_shamsi_years - intval((($this->year - 43) / 4)); |
|
476 | 476 | |
477 | -$shamsi_month = ( $days_of_shamsi_years % 365 ); |
|
477 | +$shamsi_month = ($days_of_shamsi_years % 365); |
|
478 | 478 | |
479 | -$shamsi_year = intval( $days_of_shamsi_years / 365 ) + 1; |
|
479 | +$shamsi_year = intval($days_of_shamsi_years / 365) + 1; |
|
480 | 480 | |
481 | 481 | foreach ($this->config['shamsi_month_days'] as $month => $value) { |
482 | 482 | |
483 | - if ( $shamsi_month < $value ) break; |
|
483 | + if ($shamsi_month < $value) break; |
|
484 | 484 | |
485 | 485 | $shamsi_month -= $value; |
486 | 486 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | $shamsi_month = $month; |
491 | 491 | |
492 | - $this->date_time->setDate( $shamsi_year, $shamsi_month, $shamsi_day ); |
|
492 | + $this->date_time->setDate($shamsi_year, $shamsi_month, $shamsi_day); |
|
493 | 493 | |
494 | 494 | return $this->date_time; |
495 | 495 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @since Oct, 17 2015 |
501 | 501 | * @return object |
502 | 502 | */ |
503 | - public function ghamariToGregorian( $date_time ) { |
|
503 | + public function ghamariToGregorian($date_time) { |
|
504 | 504 | |
505 | 505 | $this->date_time = $date_time; |
506 | 506 | |
@@ -512,29 +512,29 @@ discard block |
||
512 | 512 | |
513 | 513 | $days_of_year = 0; |
514 | 514 | |
515 | - foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
|
515 | + foreach ($this->config['islamic_month_days'] as $month => $value) { |
|
516 | 516 | |
517 | - if( $this->month > $month ) $days_of_year += $value; |
|
517 | + if ($this->month > $month) $days_of_year += $value; |
|
518 | 518 | |
519 | 519 | } |
520 | 520 | |
521 | 521 | $days_of_year += $this->day; |
522 | 522 | |
523 | - $days_of_leap_years = intval( ( ( $this->year - 1 ) / 3 ) ); |
|
523 | + $days_of_leap_years = intval((($this->year - 1) / 3)); |
|
524 | 524 | |
525 | - $days_of_ghamari_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
525 | + $days_of_ghamari_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
526 | 526 | |
527 | 527 | $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
528 | 528 | |
529 | - $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 578 ) / 4 ) ); |
|
529 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 578) / 4)); |
|
530 | 530 | |
531 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
531 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
532 | 532 | |
533 | - $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1; |
|
533 | + $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
|
534 | 534 | |
535 | 535 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
536 | 536 | |
537 | - if ( $gregorian_month < $value ) break; |
|
537 | + if ($gregorian_month < $value) break; |
|
538 | 538 | |
539 | 539 | $gregorian_month -= $value; |
540 | 540 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | $gregorian_month = $month; |
545 | 545 | |
546 | - $this->date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day ); |
|
546 | + $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
|
547 | 547 | |
548 | 548 | return $this->date_time; |
549 | 549 |
@@ -125,17 +125,19 @@ discard block |
||
125 | 125 | |
126 | 126 | $this->leap = new leap( $this->year ); |
127 | 127 | |
128 | - if( $this->leap->get() && $this->month > 2 ) $this->temp_day++; |
|
128 | + if( $this->leap->get() && $this->month > 2 ) { |
|
129 | + $this->temp_day++; |
|
130 | + } |
|
129 | 131 | |
130 | 132 | if ( $this->temp_day <= 79 ) { |
131 | 133 | |
132 | - if( ( $this->year - 1 ) % 4 == 0 ) |
|
133 | - |
|
134 | + if( ( $this->year - 1 ) % 4 == 0 ) { |
|
135 | + |
|
134 | 136 | $this->temp_day = $this->temp_day + 11; |
135 | - |
|
136 | - else |
|
137 | - |
|
137 | + } else { |
|
138 | + |
|
138 | 139 | $this->temp_day = $this->temp_day + 10; |
140 | + } |
|
139 | 141 | |
140 | 142 | $this->year = $this->year - 622; |
141 | 143 | |
@@ -145,9 +147,7 @@ discard block |
||
145 | 147 | |
146 | 148 | $this->day = 30; |
147 | 149 | |
148 | - } |
|
149 | - |
|
150 | - else { |
|
150 | + } else { |
|
151 | 151 | |
152 | 152 | $this->month = ( $this->temp_day / 30 ) + 10; |
153 | 153 | |
@@ -155,9 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | - } |
|
159 | - |
|
160 | - else { |
|
158 | + } else { |
|
161 | 159 | |
162 | 160 | $this->year = $this->year - 621; |
163 | 161 | |
@@ -170,18 +168,14 @@ discard block |
||
170 | 168 | $this->month = ( $this->temp_day / 31 ); |
171 | 169 | |
172 | 170 | $this->day = 31; |
173 | - } |
|
174 | - |
|
175 | - else { |
|
171 | + } else { |
|
176 | 172 | |
177 | 173 | $this->month = ( $this->temp_day / 31 ) + 1; |
178 | 174 | |
179 | 175 | $this->day = ( $this->temp_day % 31 ); |
180 | 176 | } |
181 | 177 | |
182 | - } |
|
183 | - |
|
184 | - else { |
|
178 | + } else { |
|
185 | 179 | |
186 | 180 | $this->temp_day = $this->temp_day - 186; |
187 | 181 | |
@@ -191,9 +185,7 @@ discard block |
||
191 | 185 | |
192 | 186 | $this->day = 30; |
193 | 187 | |
194 | - } |
|
195 | - |
|
196 | - else { |
|
188 | + } else { |
|
197 | 189 | |
198 | 190 | $this->month = ( $this->temp_day / 30 ) + 7; |
199 | 191 | |
@@ -240,7 +232,9 @@ discard block |
||
240 | 232 | |
241 | 233 | $this->leap = new leap( $this->year ); |
242 | 234 | |
243 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
235 | + if( $this->leap->get() && $this->month > 11 ) { |
|
236 | + $this->temp_day++; |
|
237 | + } |
|
244 | 238 | |
245 | 239 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
246 | 240 | |
@@ -314,7 +308,9 @@ discard block |
||
314 | 308 | |
315 | 309 | foreach ( $this->config['shamsi_month_days'] as $month => $value ) { |
316 | 310 | |
317 | - if( $this->month > $month ) $days_of_year += $value; |
|
311 | + if( $this->month > $month ) { |
|
312 | + $days_of_year += $value; |
|
313 | + } |
|
318 | 314 | |
319 | 315 | } |
320 | 316 | |
@@ -330,9 +326,7 @@ discard block |
||
330 | 326 | |
331 | 327 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 621 ) / 4 ) ); |
332 | 328 | |
333 | -} |
|
334 | - |
|
335 | -elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
329 | +} elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
336 | 330 | |
337 | 331 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 622 ) / 4 ) ); |
338 | 332 | |
@@ -344,7 +338,9 @@ discard block |
||
344 | 338 | |
345 | 339 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
346 | 340 | |
347 | - if ( $gregorian_month < $value ) break; |
|
341 | + if ( $gregorian_month < $value ) { |
|
342 | + break; |
|
343 | + } |
|
348 | 344 | |
349 | 345 | $gregorian_month -= $value; |
350 | 346 | } |
@@ -387,7 +383,9 @@ discard block |
||
387 | 383 | |
388 | 384 | $this->leap = new leap( $this->year ); |
389 | 385 | |
390 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
386 | + if( $this->leap->get() && $this->month > 11 ) { |
|
387 | + $this->temp_day++; |
|
388 | + } |
|
391 | 389 | |
392 | 390 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
393 | 391 | |
@@ -460,7 +458,9 @@ discard block |
||
460 | 458 | |
461 | 459 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
462 | 460 | |
463 | - if( $this->month > $month ) $days_of_year += $value; |
|
461 | + if( $this->month > $month ) { |
|
462 | + $days_of_year += $value; |
|
463 | + } |
|
464 | 464 | |
465 | 465 | } |
466 | 466 | |
@@ -480,7 +480,9 @@ discard block |
||
480 | 480 | |
481 | 481 | foreach ($this->config['shamsi_month_days'] as $month => $value) { |
482 | 482 | |
483 | - if ( $shamsi_month < $value ) break; |
|
483 | + if ( $shamsi_month < $value ) { |
|
484 | + break; |
|
485 | + } |
|
484 | 486 | |
485 | 487 | $shamsi_month -= $value; |
486 | 488 | } |
@@ -514,7 +516,9 @@ discard block |
||
514 | 516 | |
515 | 517 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
516 | 518 | |
517 | - if( $this->month > $month ) $days_of_year += $value; |
|
519 | + if( $this->month > $month ) { |
|
520 | + $days_of_year += $value; |
|
521 | + } |
|
518 | 522 | |
519 | 523 | } |
520 | 524 | |
@@ -534,7 +538,9 @@ discard block |
||
534 | 538 | |
535 | 539 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
536 | 540 | |
537 | - if ( $gregorian_month < $value ) break; |
|
541 | + if ( $gregorian_month < $value ) { |
|
542 | + break; |
|
543 | + } |
|
538 | 544 | |
539 | 545 | $gregorian_month -= $value; |
540 | 546 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * Get current datetime |
110 | 110 | * @since Aug 17 2015 |
111 | - * @return object |
|
111 | + * @return Datium |
|
112 | 112 | */ |
113 | 113 | public static function now() { |
114 | 114 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param $hour integer |
127 | 127 | * @param $minute integer |
128 | 128 | * @param $second integer |
129 | - * @return object |
|
129 | + * @return Datium |
|
130 | 130 | */ |
131 | 131 | public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
132 | 132 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | /** |
189 | 189 | * Add new date value to current date |
190 | 190 | * @param $value string |
191 | - * @return object |
|
191 | + * @return Datium |
|
192 | 192 | */ |
193 | 193 | public function add( $value ) { |
194 | 194 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Check if current year is leap or not |
224 | - * @return boolean |
|
224 | + * @return Leap |
|
225 | 225 | */ |
226 | 226 | public function leap( $type = 'gr') { |
227 | 227 | |
@@ -261,6 +261,10 @@ discard block |
||
261 | 261 | |
262 | 262 | } |
263 | 263 | |
264 | + /** |
|
265 | + * @param string $calendar |
|
266 | + * @param string $format |
|
267 | + */ |
|
264 | 268 | public function translate( $calendar, $format ) { |
265 | 269 | |
266 | 270 | $this->date_time = new Translate( $this->date_time, $calendar, $format, $this->gregorian_DayofWeek ); |
@@ -351,7 +351,7 @@ |
||
351 | 351 | |
352 | 352 | } |
353 | 353 | |
354 | - $this->calendar_type = 'gh'; |
|
354 | + $this->calendar_type = 'gh'; |
|
355 | 355 | |
356 | 356 | return $this; |
357 | 357 |
@@ -337,17 +337,17 @@ |
||
337 | 337 | |
338 | 338 | switch ( $type ) { |
339 | 339 | |
340 | - case 'ir': |
|
340 | + case 'ir': |
|
341 | 341 | |
342 | - $this->date_time = $this->convert_calendar->shamsiToGhamari( $this->date_time ); |
|
342 | + $this->date_time = $this->convert_calendar->shamsiToGhamari( $this->date_time ); |
|
343 | 343 | |
344 | - break; |
|
344 | + break; |
|
345 | 345 | |
346 | - case 'gr': |
|
346 | + case 'gr': |
|
347 | 347 | |
348 | - $this->date_time = $this->convert_calendar->gregorianToGhamari( $this->date_time ); |
|
348 | + $this->date_time = $this->convert_calendar->gregorianToGhamari( $this->date_time ); |
|
349 | 349 | |
350 | - break; |
|
350 | + break; |
|
351 | 351 | |
352 | 352 | } |
353 | 353 |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | |
61 | 61 | $this->config = include('Config.php'); |
62 | 62 | |
63 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
63 | + $this->calendar_type = $this->config['default_calendar']; |
|
64 | 64 | |
65 | - date_default_timezone_set( $this->config['timezone'] ); |
|
65 | + date_default_timezone_set($this->config['timezone']); |
|
66 | 66 | |
67 | - switch( Datium::$call_type ) { |
|
67 | + switch (Datium::$call_type) { |
|
68 | 68 | |
69 | 69 | case 'now': |
70 | 70 | |
71 | - $this->date_time = new DateTime( 'now' ); |
|
71 | + $this->date_time = new DateTime('now'); |
|
72 | 72 | |
73 | 73 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
74 | 74 | |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | |
79 | 79 | case 'make': |
80 | 80 | |
81 | - $this->date_time = new DateTime( 'now' ); |
|
81 | + $this->date_time = new DateTime('now'); |
|
82 | 82 | |
83 | - $this->date_time->setDate( self::$array_date['year'], self::$array_date['month'], self::$array_date['day'] ); |
|
83 | + $this->date_time->setDate(self::$array_date['year'], self::$array_date['month'], self::$array_date['day']); |
|
84 | 84 | |
85 | - $this->date_time->setTime( self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second'] ); |
|
85 | + $this->date_time->setTime(self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second']); |
|
86 | 86 | |
87 | 87 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
88 | 88 | |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | * @param $second integer |
129 | 129 | * @return object |
130 | 130 | */ |
131 | - public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) { |
|
131 | + public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) { |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * When we want to set a Datetime object to Datium |
135 | 135 | */ |
136 | - if( func_num_args() === 1 ) { |
|
136 | + if (func_num_args() === 1) { |
|
137 | 137 | |
138 | 138 | self::$static_date_time = func_get_arg(0); |
139 | 139 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | } else { |
143 | 143 | |
144 | - self::$array_date = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second ); |
|
144 | + self::$array_date = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second); |
|
145 | 145 | |
146 | 146 | self::$call_type = 'make'; |
147 | 147 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | } |
153 | 153 | |
154 | - public static function between( $date_start, $date_end ) { |
|
154 | + public static function between($date_start, $date_end) { |
|
155 | 155 | |
156 | 156 | self::$date_start = $date_start; |
157 | 157 | |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | |
164 | 164 | } |
165 | 165 | |
166 | - public function to( $calendar ) { |
|
166 | + public function to($calendar) { |
|
167 | 167 | |
168 | - $this->convert = new Convert( $this->date_time ); |
|
168 | + $this->convert = new Convert($this->date_time); |
|
169 | 169 | |
170 | - $this->date_time = $this->convert->to( $calendar ); |
|
170 | + $this->date_time = $this->convert->to($calendar); |
|
171 | 171 | |
172 | 172 | return $this; |
173 | 173 | |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | * @param $start datetime |
180 | 180 | * @param $end datetime |
181 | 181 | */ |
182 | - public static function diff( $start, $end ) { |
|
182 | + public static function diff($start, $end) { |
|
183 | 183 | |
184 | - return date_diff( $start, $end ); |
|
184 | + return date_diff($start, $end); |
|
185 | 185 | |
186 | 186 | } |
187 | 187 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @param $value string |
191 | 191 | * @return object |
192 | 192 | */ |
193 | - public function add( $value ) { |
|
193 | + public function add($value) { |
|
194 | 194 | |
195 | - $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value ); |
|
195 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
196 | 196 | |
197 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
197 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
198 | 198 | |
199 | - $this->date_time->add( new DateInterval( $this->date_interval_expression ) ); |
|
199 | + $this->date_time->add(new DateInterval($this->date_interval_expression)); |
|
200 | 200 | |
201 | 201 | return $this; |
202 | 202 | |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | * @param $value |
208 | 208 | * @param return obejct |
209 | 209 | */ |
210 | - public function sub( $value ) { |
|
210 | + public function sub($value) { |
|
211 | 211 | |
212 | - $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value ); |
|
212 | + $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value); |
|
213 | 213 | |
214 | - $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression ); |
|
214 | + $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression); |
|
215 | 215 | |
216 | - $this->date_time->sub( new DateInterval( $this->date_interval_expression ) ); |
|
216 | + $this->date_time->sub(new DateInterval($this->date_interval_expression)); |
|
217 | 217 | |
218 | 218 | return $this; |
219 | 219 | |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | * Check if current year is leap or not |
224 | 224 | * @return boolean |
225 | 225 | */ |
226 | - public function leap( $type = 'gr') { |
|
226 | + public function leap($type = 'gr') { |
|
227 | 227 | |
228 | - $this->leap = new Leap( $this->date_time->format( 'Y' ), $type ); |
|
228 | + $this->leap = new Leap($this->date_time->format('Y'), $type); |
|
229 | 229 | |
230 | 230 | return $this->leap; |
231 | 231 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function dayOf() { |
238 | 238 | |
239 | - $this->day_of = new DayOf( $this->date_time, $this->calendar_type ); |
|
239 | + $this->day_of = new DayOf($this->date_time, $this->calendar_type); |
|
240 | 240 | |
241 | 241 | return $this->day_of; |
242 | 242 | |
@@ -247,13 +247,13 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function events() { |
249 | 249 | |
250 | - if ( Datium::$call_type == 'between' ) { |
|
250 | + if (Datium::$call_type == 'between') { |
|
251 | 251 | |
252 | - $this->events = new Events( Datium::$date_start, Datium::$date_end ); |
|
252 | + $this->events = new Events(Datium::$date_start, Datium::$date_end); |
|
253 | 253 | |
254 | 254 | } else { |
255 | 255 | |
256 | - $this->events = new Events( $this->date_time ); |
|
256 | + $this->events = new Events($this->date_time); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | |
262 | 262 | } |
263 | 263 | |
264 | - public function translate( $calendar, $format ) { |
|
264 | + public function translate($calendar, $format) { |
|
265 | 265 | |
266 | - $this->date_time = new Translate( $this->date_time, $calendar, $format, $this->gregorian_DayofWeek ); |
|
266 | + $this->date_time = new Translate($this->date_time, $calendar, $format, $this->gregorian_DayofWeek); |
|
267 | 267 | |
268 | 268 | return $this->date_time; |
269 | 269 | |
@@ -310,19 +310,19 @@ discard block |
||
310 | 310 | // |
311 | 311 | // } |
312 | 312 | |
313 | - public function toShamsi( $type = 'gr' ) { |
|
313 | + public function toShamsi($type = 'gr') { |
|
314 | 314 | |
315 | - switch ( $type ) { |
|
315 | + switch ($type) { |
|
316 | 316 | |
317 | 317 | case 'gr': |
318 | 318 | |
319 | - $this->date_time = $this->convert_calendar->gregorianToShamsi( $this->date_time ); |
|
319 | + $this->date_time = $this->convert_calendar->gregorianToShamsi($this->date_time); |
|
320 | 320 | |
321 | 321 | break; |
322 | 322 | |
323 | 323 | case 'gh': |
324 | 324 | |
325 | - $this->date_time = $this->convert_calendar->ghamariToShamsi( $this->date_time ); |
|
325 | + $this->date_time = $this->convert_calendar->ghamariToShamsi($this->date_time); |
|
326 | 326 | |
327 | 327 | break; |
328 | 328 | } |
@@ -333,19 +333,19 @@ discard block |
||
333 | 333 | |
334 | 334 | } |
335 | 335 | |
336 | - public function toGhamari( $type = 'gr') { |
|
336 | + public function toGhamari($type = 'gr') { |
|
337 | 337 | |
338 | -switch ( $type ) { |
|
338 | +switch ($type) { |
|
339 | 339 | |
340 | 340 | case 'ir': |
341 | 341 | |
342 | - $this->date_time = $this->convert_calendar->shamsiToGhamari( $this->date_time ); |
|
342 | + $this->date_time = $this->convert_calendar->shamsiToGhamari($this->date_time); |
|
343 | 343 | |
344 | 344 | break; |
345 | 345 | |
346 | 346 | case 'gr': |
347 | 347 | |
348 | - $this->date_time = $this->convert_calendar->gregorianToGhamari( $this->date_time ); |
|
348 | + $this->date_time = $this->convert_calendar->gregorianToGhamari($this->date_time); |
|
349 | 349 | |
350 | 350 | break; |
351 | 351 | |
@@ -357,19 +357,19 @@ discard block |
||
357 | 357 | |
358 | 358 | } |
359 | 359 | |
360 | - public function toGregorian( $type = 'gr' ) { |
|
360 | + public function toGregorian($type = 'gr') { |
|
361 | 361 | |
362 | - switch ( $type ) { |
|
362 | + switch ($type) { |
|
363 | 363 | |
364 | 364 | case 'ir': |
365 | 365 | |
366 | - $this->date_time = $this->convert_calendar->shamsiToGregorian( $this->date_time ); |
|
366 | + $this->date_time = $this->convert_calendar->shamsiToGregorian($this->date_time); |
|
367 | 367 | |
368 | 368 | break; |
369 | 369 | |
370 | 370 | case 'gh': |
371 | 371 | |
372 | - $this->date_time = $this->convert_calendar->ghamariToGregorian( $this->date_time ); |
|
372 | + $this->date_time = $this->convert_calendar->ghamariToGregorian($this->date_time); |
|
373 | 373 | |
374 | 374 | case 'gr': |
375 | 375 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | * |
395 | 395 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
396 | 396 | */ |
397 | - public function object(){ |
|
397 | + public function object() { |
|
398 | 398 | |
399 | 399 | return $this->date_time; |
400 | 400 | |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | * @param $calendar string |
407 | 407 | * @param $format string |
408 | 408 | */ |
409 | - public function get( $format = 'Y-m-d H:i:s' ) { |
|
409 | + public function get($format = 'Y-m-d H:i:s') { |
|
410 | 410 | |
411 | - if( in_array( $this->calendar_type, $this->config[ 'calendar' ] ) ){ |
|
411 | + if (in_array($this->calendar_type, $this->config['calendar'])) { |
|
412 | 412 | |
413 | - return $this->translate( $this->calendar_type, $format )->get(); |
|
413 | + return $this->translate($this->calendar_type, $format)->get(); |
|
414 | 414 | |
415 | 415 | } |
416 | 416 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @since Sept, 14 2015 |
73 | - * @return integer |
|
73 | + * @return double |
|
74 | 74 | */ |
75 | 75 | protected function persian_day_of_year() { |
76 | 76 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | /** |
95 | 95 | * @since Sept, 14 2015 |
96 | - * @return integer |
|
96 | + * @return double |
|
97 | 97 | */ |
98 | 98 | protected function islamic_day_of_year() { |
99 | 99 |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->result = $this->islamic_day_of_year(); |
56 | 56 | |
57 | - break; |
|
57 | + break; |
|
58 | 58 | |
59 | 59 | case 'gr': |
60 | 60 | |
61 | 61 | $this->result = date( 'z', strtotime( $this->date_time->format('Y-m-d H:i:s') ) ) + 1; |
62 | 62 | |
63 | - break; |
|
63 | + break; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $this->result; |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | - * @since Sept, 14 2015 |
|
73 | - * @return integer |
|
74 | - */ |
|
72 | + * @since Sept, 14 2015 |
|
73 | + * @return integer |
|
74 | + */ |
|
75 | 75 | protected function persian_day_of_year() { |
76 | 76 | |
77 | 77 | $this->month = $this->date_time->format('n'); |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * @since Sept, 14 2015 |
|
96 | - * @return integer |
|
97 | - */ |
|
94 | + /** |
|
95 | + * @since Sept, 14 2015 |
|
96 | + * @return integer |
|
97 | + */ |
|
98 | 98 | protected function islamic_day_of_year() { |
99 | 99 | |
100 | 100 | $this->month = $this->date_time->format('n'); |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | |
133 | 133 | $this->result = $this->islamic_day_of_week(); |
134 | 134 | |
135 | - break; |
|
135 | + break; |
|
136 | 136 | |
137 | 137 | case 'gr': |
138 | 138 | |
139 | 139 | $this->result = date( 'w', strtotime( $this->date_time->format('Y-m-d H:i:s') ) ) + 1; |
140 | 140 | |
141 | - break; |
|
141 | + break; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $this->result; |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | - * @since Sept, 14 2015 |
|
166 | - * @return integer |
|
167 | - */ |
|
165 | + * @since Sept, 14 2015 |
|
166 | + * @return integer |
|
167 | + */ |
|
168 | 168 | protected function islamic_day_of_week() { |
169 | 169 | |
170 | 170 | $this->day = str_replace( $this->config['week_days_name']['english'], $this->config['week_days_name']['islamic'][$this->geregorian_DayofWeek], $this->day); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | protected $geregorian_DayofWeek; |
21 | 21 | |
22 | - public function __construct( $date_time, $calendar_type = 'ir' ) { |
|
22 | + public function __construct($date_time, $calendar_type = 'ir') { |
|
23 | 23 | |
24 | - $this->config = include( 'Config.php' ); |
|
24 | + $this->config = include('Config.php'); |
|
25 | 25 | |
26 | 26 | $this->date_time = $date_time; |
27 | 27 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function year() { |
44 | 44 | |
45 | - switch ( $this->calendar_type ) { |
|
45 | + switch ($this->calendar_type) { |
|
46 | 46 | |
47 | 47 | case 'ir': |
48 | 48 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | case 'gr': |
60 | 60 | |
61 | - $this->result = date( 'z', strtotime( $this->date_time->format('Y-m-d H:i:s') ) ) + 1; |
|
61 | + $this->result = date('z', strtotime($this->date_time->format('Y-m-d H:i:s'))) + 1; |
|
62 | 62 | |
63 | 63 | break; |
64 | 64 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | $this->day = $this->date_time->format('d'); |
80 | 80 | |
81 | - foreach( $this->config['shamsi_month_days'] as $month => $value ) { |
|
81 | + foreach ($this->config['shamsi_month_days'] as $month => $value) { |
|
82 | 82 | |
83 | - if ( $month < $this->month ) $this->result += $value; |
|
83 | + if ($month < $this->month) $this->result += $value; |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | |
102 | 102 | $this->day = $this->date_time->format('d'); |
103 | 103 | |
104 | - foreach( $this->config['islamic_month_days'] as $month => $value ) { |
|
104 | + foreach ($this->config['islamic_month_days'] as $month => $value) { |
|
105 | 105 | |
106 | - if ( $month < $this->month ) $this->result += $value; |
|
106 | + if ($month < $this->month) $this->result += $value; |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function week() { |
122 | 122 | |
123 | - switch ( $this->calendar_type ) { |
|
123 | + switch ($this->calendar_type) { |
|
124 | 124 | |
125 | 125 | case 'ir': |
126 | 126 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | case 'gr': |
138 | 138 | |
139 | - $this->result = date( 'w', strtotime( $this->date_time->format('Y-m-d H:i:s') ) ) + 1; |
|
139 | + $this->result = date('w', strtotime($this->date_time->format('Y-m-d H:i:s'))) + 1; |
|
140 | 140 | |
141 | 141 | break; |
142 | 142 | } |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | */ |
152 | 152 | protected function persian_day_of_week() { |
153 | 153 | |
154 | - $this->day = str_replace( $this->config['week_days_name']['english'], $this->config['week_days_name']['persian'], $this->day); |
|
154 | + $this->day = str_replace($this->config['week_days_name']['english'], $this->config['week_days_name']['persian'], $this->day); |
|
155 | 155 | |
156 | - foreach ( $this->config['week_days_name']['persian'] as $key => $value ) { |
|
156 | + foreach ($this->config['week_days_name']['persian'] as $key => $value) { |
|
157 | 157 | |
158 | - if( $value == $this->day ) return $key += 1; |
|
158 | + if ($value == $this->day) return $key += 1; |
|
159 | 159 | |
160 | 160 | } |
161 | 161 | |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function islamic_day_of_week() { |
169 | 169 | |
170 | - $this->day = str_replace( $this->config['week_days_name']['english'], $this->config['week_days_name']['islamic'][$this->geregorian_DayofWeek], $this->day); |
|
170 | + $this->day = str_replace($this->config['week_days_name']['english'], $this->config['week_days_name']['islamic'][$this->geregorian_DayofWeek], $this->day); |
|
171 | 171 | |
172 | - foreach ( $this->config['week_days_name']['islamic'] as $key => $value ) { |
|
172 | + foreach ($this->config['week_days_name']['islamic'] as $key => $value) { |
|
173 | 173 | |
174 | - if( $value == $this->day ) return $key += 1; |
|
174 | + if ($value == $this->day) return $key += 1; |
|
175 | 175 | |
176 | 176 | } |
177 | 177 |
@@ -80,7 +80,9 @@ discard block |
||
80 | 80 | |
81 | 81 | foreach( $this->config['shamsi_month_days'] as $month => $value ) { |
82 | 82 | |
83 | - if ( $month < $this->month ) $this->result += $value; |
|
83 | + if ( $month < $this->month ) { |
|
84 | + $this->result += $value; |
|
85 | + } |
|
84 | 86 | |
85 | 87 | } |
86 | 88 | |
@@ -103,7 +105,9 @@ discard block |
||
103 | 105 | |
104 | 106 | foreach( $this->config['islamic_month_days'] as $month => $value ) { |
105 | 107 | |
106 | - if ( $month < $this->month ) $this->result += $value; |
|
108 | + if ( $month < $this->month ) { |
|
109 | + $this->result += $value; |
|
110 | + } |
|
107 | 111 | |
108 | 112 | } |
109 | 113 | |
@@ -155,7 +159,9 @@ discard block |
||
155 | 159 | |
156 | 160 | foreach ( $this->config['week_days_name']['persian'] as $key => $value ) { |
157 | 161 | |
158 | - if( $value == $this->day ) return $key += 1; |
|
162 | + if( $value == $this->day ) { |
|
163 | + return $key += 1; |
|
164 | + } |
|
159 | 165 | |
160 | 166 | } |
161 | 167 | |
@@ -171,7 +177,9 @@ discard block |
||
171 | 177 | |
172 | 178 | foreach ( $this->config['week_days_name']['islamic'] as $key => $value ) { |
173 | 179 | |
174 | - if( $value == $this->day ) return $key += 1; |
|
180 | + if( $value == $this->day ) { |
|
181 | + return $key += 1; |
|
182 | + } |
|
175 | 183 | |
176 | 184 | } |
177 | 185 |
@@ -56,6 +56,10 @@ |
||
56 | 56 | * |
57 | 57 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
58 | 58 | */ |
59 | + |
|
60 | + /** |
|
61 | + * @param string $path |
|
62 | + */ |
|
59 | 63 | private function fetch( $path ) { |
60 | 64 | |
61 | 65 | $this->events = include( $path ); |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php namespace Datium; |
2 | 2 | |
3 | 3 | use Datium\Tools\Convert; |
4 | -use Datium\Tools\DayOf; |
|
5 | 4 | use DateTime; |
6 | 5 | use DateInterval; |
7 | 6 | use DatePeriod; |
@@ -8,47 +8,47 @@ discard block |
||
8 | 8 | |
9 | 9 | class Events { |
10 | 10 | |
11 | - private $local; |
|
11 | + private $local; |
|
12 | 12 | |
13 | - private $events; |
|
13 | + private $events; |
|
14 | 14 | |
15 | - private $date_time; |
|
15 | + private $date_time; |
|
16 | 16 | |
17 | - private $convert; |
|
17 | + private $convert; |
|
18 | 18 | |
19 | - private $result; |
|
19 | + private $result; |
|
20 | 20 | |
21 | - private $period; |
|
21 | + private $period; |
|
22 | 22 | |
23 | - private $interval; |
|
23 | + private $interval; |
|
24 | 24 | |
25 | - private static $date_start; |
|
25 | + private static $date_start; |
|
26 | 26 | |
27 | - private static $date_end; |
|
27 | + private static $date_end; |
|
28 | 28 | |
29 | - public function __construct( $date_time, $date_end = NULL ) { |
|
29 | + public function __construct( $date_time, $date_end = NULL ) { |
|
30 | 30 | |
31 | - if( $date_end !== NULL ) { |
|
31 | + if( $date_end !== NULL ) { |
|
32 | 32 | |
33 | - Events::$date_start = $date_time; |
|
33 | + Events::$date_start = $date_time; |
|
34 | 34 | |
35 | - Events::$date_end = $date_end; |
|
35 | + Events::$date_end = $date_end; |
|
36 | 36 | |
37 | - } else { |
|
37 | + } else { |
|
38 | 38 | |
39 | - Events::$date_start = $date_time; |
|
39 | + Events::$date_start = $date_time; |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - $this->convert = new Convert; |
|
43 | + $this->convert = new Convert; |
|
44 | 44 | |
45 | - $this->date_time = new DateTime(); |
|
45 | + $this->date_time = new DateTime(); |
|
46 | 46 | |
47 | - return $this; |
|
47 | + return $this; |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - /************************************************************ |
|
51 | + /************************************************************ |
|
52 | 52 | * Fetch Events array from own array file |
53 | 53 | ************************************************************ |
54 | 54 | * |
@@ -56,27 +56,27 @@ discard block |
||
56 | 56 | * |
57 | 57 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
58 | 58 | */ |
59 | - private function fetch( $path ) { |
|
59 | + private function fetch( $path ) { |
|
60 | 60 | |
61 | - $this->events = include( $path ); |
|
61 | + $this->events = include( $path ); |
|
62 | 62 | |
63 | - $this->interval = DateInterval::createFromDateString('1 day'); |
|
63 | + $this->interval = DateInterval::createFromDateString('1 day'); |
|
64 | 64 | |
65 | - $this->period = new DatePeriod( Events::$date_start, $this->interval, Events::$date_end ); |
|
65 | + $this->period = new DatePeriod( Events::$date_start, $this->interval, Events::$date_end ); |
|
66 | 66 | |
67 | - foreach ( $this->period as $dt ) { |
|
67 | + foreach ( $this->period as $dt ) { |
|
68 | 68 | |
69 | - if ( isset( $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ] ) ) { |
|
69 | + if ( isset( $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ] ) ) { |
|
70 | 70 | |
71 | - $this->result[ $dt->format( 'Y-m-d' ) ][] = $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ]; |
|
71 | + $this->result[ $dt->format( 'Y-m-d' ) ][] = $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ]; |
|
72 | 72 | |
73 | - } |
|
73 | + } |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | - /************************************************************ |
|
79 | + /************************************************************ |
|
80 | 80 | * Return Array of Events |
81 | 81 | ************************************************************ |
82 | 82 | * |
@@ -85,31 +85,31 @@ discard block |
||
85 | 85 | * |
86 | 86 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
87 | 87 | */ |
88 | - public function get() { |
|
88 | + public function get() { |
|
89 | 89 | |
90 | - if( ! empty( $this->result ) ) { |
|
90 | + if( ! empty( $this->result ) ) { |
|
91 | 91 | |
92 | - foreach( $this->result as $key => $day ) { |
|
92 | + foreach( $this->result as $key => $day ) { |
|
93 | 93 | |
94 | - if ( ! ( $key > Events::$date_start->format( 'Y-m-d' ) && $key < Events::$date_end->format( 'Y-m-d' ) ) ) { |
|
94 | + if ( ! ( $key > Events::$date_start->format( 'Y-m-d' ) && $key < Events::$date_end->format( 'Y-m-d' ) ) ) { |
|
95 | 95 | |
96 | - unset( $this->result[ $key ] ); |
|
96 | + unset( $this->result[ $key ] ); |
|
97 | 97 | |
98 | - } |
|
98 | + } |
|
99 | 99 | |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | - } else { |
|
102 | + } else { |
|
103 | 103 | |
104 | - $this->result = array(); |
|
104 | + $this->result = array(); |
|
105 | 105 | |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | - return $this->result; |
|
108 | + return $this->result; |
|
109 | 109 | |
110 | - } |
|
110 | + } |
|
111 | 111 | |
112 | - /************************************************************ |
|
112 | + /************************************************************ |
|
113 | 113 | * Return local events - with day start and end as an array |
114 | 114 | ************************************************************ |
115 | 115 | * |
@@ -118,72 +118,72 @@ discard block |
||
118 | 118 | * |
119 | 119 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
120 | 120 | */ |
121 | - public function local( $country_code = "ir" ) { |
|
121 | + public function local( $country_code = "ir" ) { |
|
122 | 122 | |
123 | - /* |
|
123 | + /* |
|
124 | 124 | * Capitalize the first character of $country_code according the file |
125 | 125 | * structure. |
126 | 126 | */ |
127 | - $country_code = strtolower( $country_code = 'ir' ) ; |
|
127 | + $country_code = strtolower( $country_code = 'ir' ) ; |
|
128 | 128 | |
129 | - $this->local = include( 'Localization/' . $country_code . '.php' ); |
|
129 | + $this->local = include( 'Localization/' . $country_code . '.php' ); |
|
130 | 130 | |
131 | - foreach( $this->local[ 'events' ] as $month => $events ) { |
|
131 | + foreach( $this->local[ 'events' ] as $month => $events ) { |
|
132 | 132 | |
133 | - foreach( $events as $day => $event ){ |
|
133 | + foreach( $events as $day => $event ){ |
|
134 | 134 | |
135 | - $this->date_time = new DateTime(); |
|
135 | + $this->date_time = new DateTime(); |
|
136 | 136 | |
137 | - $this->date_time->setDate( Events::$date_start->format( 'Y' ), $month, $day ); |
|
137 | + $this->date_time->setDate( Events::$date_start->format( 'Y' ), $month, $day ); |
|
138 | 138 | |
139 | - switch ( $this->local[ 'default_calendar' ] ) { |
|
139 | + switch ( $this->local[ 'default_calendar' ] ) { |
|
140 | 140 | |
141 | - case 'shamsi': |
|
141 | + case 'shamsi': |
|
142 | 142 | |
143 | - $this->date_time->setDate( 1394, $month, $day ); |
|
143 | + $this->date_time->setDate( 1394, $month, $day ); |
|
144 | 144 | |
145 | - $this->date_time = $this->convert->shamsiToGregorian( $this->date_time ); |
|
145 | + $this->date_time = $this->convert->shamsiToGregorian( $this->date_time ); |
|
146 | 146 | |
147 | - break; |
|
147 | + break; |
|
148 | 148 | |
149 | - case 'ghamari': |
|
149 | + case 'ghamari': |
|
150 | 150 | |
151 | - $this->date_time = $this->convert->ghamariToGregorian( $this->date_time ); |
|
151 | + $this->date_time = $this->convert->ghamariToGregorian( $this->date_time ); |
|
152 | 152 | |
153 | - break; |
|
153 | + break; |
|
154 | 154 | |
155 | - } |
|
155 | + } |
|
156 | 156 | |
157 | - $this->result[ $this->date_time->format( 'Y-m-d' ) ][] = $event; |
|
157 | + $this->result[ $this->date_time->format( 'Y-m-d' ) ][] = $event; |
|
158 | 158 | |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | - } |
|
161 | + } |
|
162 | 162 | |
163 | - ksort( $this->result ); |
|
163 | + ksort( $this->result ); |
|
164 | 164 | |
165 | - return $this; |
|
165 | + return $this; |
|
166 | 166 | |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | - public function weekend() { |
|
169 | + public function weekend() { |
|
170 | 170 | |
171 | - return 0; |
|
171 | + return 0; |
|
172 | 172 | |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - public function relagious() { |
|
175 | + public function relagious() { |
|
176 | 176 | |
177 | - return 0; |
|
177 | + return 0; |
|
178 | 178 | |
179 | - } |
|
179 | + } |
|
180 | 180 | |
181 | - public function international() { |
|
181 | + public function international() { |
|
182 | 182 | |
183 | - $this->fetch( 'Global/global.php' ); |
|
183 | + $this->fetch( 'Global/global.php' ); |
|
184 | 184 | |
185 | - return $this; |
|
185 | + return $this; |
|
186 | 186 | |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | 189 | } |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | private static $date_end; |
28 | 28 | |
29 | - public function __construct( $date_time, $date_end = NULL ) { |
|
29 | + public function __construct($date_time, $date_end = NULL) { |
|
30 | 30 | |
31 | - if( $date_end !== NULL ) { |
|
31 | + if ($date_end !== NULL) { |
|
32 | 32 | |
33 | 33 | Events::$date_start = $date_time; |
34 | 34 | |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | * |
57 | 57 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
58 | 58 | */ |
59 | - private function fetch( $path ) { |
|
59 | + private function fetch($path) { |
|
60 | 60 | |
61 | - $this->events = include( $path ); |
|
61 | + $this->events = include($path); |
|
62 | 62 | |
63 | 63 | $this->interval = DateInterval::createFromDateString('1 day'); |
64 | 64 | |
65 | - $this->period = new DatePeriod( Events::$date_start, $this->interval, Events::$date_end ); |
|
65 | + $this->period = new DatePeriod(Events::$date_start, $this->interval, Events::$date_end); |
|
66 | 66 | |
67 | - foreach ( $this->period as $dt ) { |
|
67 | + foreach ($this->period as $dt) { |
|
68 | 68 | |
69 | - if ( isset( $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ] ) ) { |
|
69 | + if (isset($this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))])) { |
|
70 | 70 | |
71 | - $this->result[ $dt->format( 'Y-m-d' ) ][] = $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ]; |
|
71 | + $this->result[$dt->format('Y-m-d')][] = $this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))]; |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function get() { |
89 | 89 | |
90 | - if( ! empty( $this->result ) ) { |
|
90 | + if ( ! empty($this->result)) { |
|
91 | 91 | |
92 | - foreach( $this->result as $key => $day ) { |
|
92 | + foreach ($this->result as $key => $day) { |
|
93 | 93 | |
94 | - if ( ! ( $key > Events::$date_start->format( 'Y-m-d' ) && $key < Events::$date_end->format( 'Y-m-d' ) ) ) { |
|
94 | + if ( ! ($key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d'))) { |
|
95 | 95 | |
96 | - unset( $this->result[ $key ] ); |
|
96 | + unset($this->result[$key]); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -118,49 +118,49 @@ discard block |
||
118 | 118 | * |
119 | 119 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
120 | 120 | */ |
121 | - public function local( $country_code = "ir" ) { |
|
121 | + public function local($country_code = "ir") { |
|
122 | 122 | |
123 | 123 | /* |
124 | 124 | * Capitalize the first character of $country_code according the file |
125 | 125 | * structure. |
126 | 126 | */ |
127 | - $country_code = strtolower( $country_code = 'ir' ) ; |
|
127 | + $country_code = strtolower($country_code = 'ir'); |
|
128 | 128 | |
129 | - $this->local = include( 'Localization/' . $country_code . '.php' ); |
|
129 | + $this->local = include('Localization/'.$country_code.'.php'); |
|
130 | 130 | |
131 | - foreach( $this->local[ 'events' ] as $month => $events ) { |
|
131 | + foreach ($this->local['events'] as $month => $events) { |
|
132 | 132 | |
133 | - foreach( $events as $day => $event ){ |
|
133 | + foreach ($events as $day => $event) { |
|
134 | 134 | |
135 | 135 | $this->date_time = new DateTime(); |
136 | 136 | |
137 | - $this->date_time->setDate( Events::$date_start->format( 'Y' ), $month, $day ); |
|
137 | + $this->date_time->setDate(Events::$date_start->format('Y'), $month, $day); |
|
138 | 138 | |
139 | - switch ( $this->local[ 'default_calendar' ] ) { |
|
139 | + switch ($this->local['default_calendar']) { |
|
140 | 140 | |
141 | 141 | case 'shamsi': |
142 | 142 | |
143 | - $this->date_time->setDate( 1394, $month, $day ); |
|
143 | + $this->date_time->setDate(1394, $month, $day); |
|
144 | 144 | |
145 | - $this->date_time = $this->convert->shamsiToGregorian( $this->date_time ); |
|
145 | + $this->date_time = $this->convert->shamsiToGregorian($this->date_time); |
|
146 | 146 | |
147 | 147 | break; |
148 | 148 | |
149 | 149 | case 'ghamari': |
150 | 150 | |
151 | - $this->date_time = $this->convert->ghamariToGregorian( $this->date_time ); |
|
151 | + $this->date_time = $this->convert->ghamariToGregorian($this->date_time); |
|
152 | 152 | |
153 | 153 | break; |
154 | 154 | |
155 | 155 | } |
156 | 156 | |
157 | - $this->result[ $this->date_time->format( 'Y-m-d' ) ][] = $event; |
|
157 | + $this->result[$this->date_time->format('Y-m-d')][] = $event; |
|
158 | 158 | |
159 | 159 | } |
160 | 160 | |
161 | 161 | } |
162 | 162 | |
163 | - ksort( $this->result ); |
|
163 | + ksort($this->result); |
|
164 | 164 | |
165 | 165 | return $this; |
166 | 166 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | public function international() { |
182 | 182 | |
183 | - $this->fetch( 'Global/global.php' ); |
|
183 | + $this->fetch('Global/global.php'); |
|
184 | 184 | |
185 | 185 | return $this; |
186 | 186 |
@@ -100,7 +100,7 @@ |
||
100 | 100 | /** |
101 | 101 | * check the ghamari year is leap or not |
102 | 102 | * @since Oct, 24 2015 |
103 | - * @return boolean |
|
103 | + * @return integer|null |
|
104 | 104 | */ |
105 | 105 | public function ghamariLeapYear() { |
106 | 106 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | /** |
9 | 9 | * @param integer store year value |
10 | 10 | */ |
11 | - protected $year; |
|
11 | + protected $year; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param string store type of year value |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | * @param $year integer |
26 | 26 | * @since Aug, 21 2015 |
27 | 27 | */ |
28 | - public function __construct( $year, $type = 'gr' ) { |
|
28 | + public function __construct( $year, $type = 'gr' ) { |
|
29 | 29 | |
30 | - $this->year = $year; |
|
30 | + $this->year = $year; |
|
31 | 31 | |
32 | 32 | $this->type = $type; |
33 | 33 | |
34 | 34 | return $this; |
35 | 35 | |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | 39 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function shamsiLeapYear() { |
56 | 56 | |
57 | - $shamsi_years = 0; |
|
57 | + $shamsi_years = 0; |
|
58 | 58 | |
59 | 59 | while ( $shamsi_years < ( $this->year - 128 ) ) { |
60 | 60 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $this->result = $this->result % 33; |
73 | 73 | |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | if ( ( $this->result == 28 ) || ( $this->result == 27 ) ) { |
77 | 77 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $this->result = $this->result % 33; |
90 | 90 | |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | if ( ( ( $this->result % 4 ) == 0 ) && ( $this->result != 28 ) ) { |
94 | 94 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | $this->result = $this->shamsiLeapYear(); |
135 | 135 | |
136 | - break; |
|
136 | + break; |
|
137 | 137 | |
138 | 138 | case 'gh': |
139 | 139 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param $year integer |
26 | 26 | * @since Aug, 21 2015 |
27 | 27 | */ |
28 | - public function __construct( $year, $type = 'gr' ) { |
|
28 | + public function __construct($year, $type = 'gr') { |
|
29 | 29 | |
30 | 30 | $this->year = $year; |
31 | 31 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function gregorinLeapYear() { |
45 | 45 | |
46 | - return ( ( ( $this->year % 4 ) == 0 ) && ( ( ( $this->year % 100 ) != 0 ) || ( ( $this->year % 400 ) == 0 ) ) ); |
|
46 | + return ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0))); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $shamsi_years = 0; |
58 | 58 | |
59 | - while ( $shamsi_years < ( $this->year - 128 ) ) { |
|
59 | + while ($shamsi_years < ($this->year - 128)) { |
|
60 | 60 | |
61 | 61 | $shamsi_years += 128; |
62 | 62 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | |
68 | 68 | $this->result -= $shamsi_years; |
69 | 69 | |
70 | - if ( $this->result >= 33 ) { |
|
70 | + if ($this->result >= 33) { |
|
71 | 71 | |
72 | 72 | $this->result = $this->result % 33; |
73 | 73 | |
74 | 74 | } |
75 | 75 | |
76 | - if ( ( $this->result == 28 ) || ( $this->result == 27 ) ) { |
|
76 | + if (($this->result == 28) || ($this->result == 27)) { |
|
77 | 77 | |
78 | 78 | return $this->result; |
79 | 79 | |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | |
85 | 85 | $this->result -= $shamsi_years; |
86 | 86 | |
87 | - if ( $this->result >= 33 ) { |
|
87 | + if ($this->result >= 33) { |
|
88 | 88 | |
89 | 89 | $this->result = $this->result % 33; |
90 | 90 | |
91 | 91 | } |
92 | 92 | |
93 | - if ( ( ( $this->result % 4 ) == 0 ) && ( $this->result != 28 ) ) { |
|
93 | + if ((($this->result % 4) == 0) && ($this->result != 28)) { |
|
94 | 94 | |
95 | 95 | return $this->result; |
96 | 96 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $this->result = $this->year % 30; |
108 | 108 | |
109 | - if ( ( 2 == $this->result ) || ( 5 == $this->result ) || ( 7 == $this->result ) || ( 10 == $this->result ) || ( 13 == $this->result ) || ( 16 == $this->result ) || ( 18 == $this->result ) || ( 21 == $this->result ) || ( 24 == $this->year ) || ( 26 == $this->result ) || ( 29 == $this->result ) ) { |
|
109 | + if ((2 == $this->result) || (5 == $this->result) || (7 == $this->result) || (10 == $this->result) || (13 == $this->result) || (16 == $this->result) || (18 == $this->result) || (21 == $this->result) || (24 == $this->year) || (26 == $this->result) || (29 == $this->result)) { |
|
110 | 110 | |
111 | 111 | return $this->result; |
112 | 112 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function get() { |
123 | 123 | |
124 | - switch ( $this->type ) { |
|
124 | + switch ($this->type) { |
|
125 | 125 | |
126 | 126 | case 'gr': |
127 | 127 |
@@ -20,6 +20,9 @@ |
||
20 | 20 | |
21 | 21 | protected $english_number = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ); |
22 | 22 | |
23 | + /** |
|
24 | + * @param \DateTime $date_time |
|
25 | + */ |
|
23 | 26 | public function __construct( $date_time, $calendar, $format, $gregorian_DayofWeek ){ |
24 | 27 | |
25 | 28 | $this->translate = include( 'lang/fa/general.php' ); |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | protected $gregorian_DayofWeek; |
20 | 20 | |
21 | - protected $english_number = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ); |
|
21 | + protected $english_number = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); |
|
22 | 22 | |
23 | - public function __construct( $date_time, $calendar, $format, $gregorian_DayofWeek ){ |
|
23 | + public function __construct($date_time, $calendar, $format, $gregorian_DayofWeek) { |
|
24 | 24 | |
25 | - $this->translate = include( 'lang/fa/general.php' ); |
|
25 | + $this->translate = include('lang/fa/general.php'); |
|
26 | 26 | |
27 | - $this->config = include( 'config.php' ); |
|
27 | + $this->config = include('config.php'); |
|
28 | 28 | |
29 | 29 | $this->date_time = $date_time; |
30 | 30 | |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | |
39 | 39 | } |
40 | 40 | |
41 | - protected function format( $calendar, $format ) { |
|
41 | + protected function format($calendar, $format) { |
|
42 | 42 | |
43 | - $this->date_time = $this->date_time->format( $format ); |
|
43 | + $this->date_time = $this->date_time->format($format); |
|
44 | 44 | |
45 | - if( in_array( $calendar, $this->config['calendar'] ) ) { |
|
45 | + if (in_array($calendar, $this->config['calendar'])) { |
|
46 | 46 | |
47 | - switch( $calendar ){ |
|
47 | + switch ($calendar) { |
|
48 | 48 | |
49 | 49 | case 'ir': |
50 | 50 | |
@@ -74,25 +74,25 @@ discard block |
||
74 | 74 | |
75 | 75 | protected function translateToPersian() { |
76 | 76 | |
77 | - $this->date_time = str_replace( $this->config['month']['english'], $this->config['month']['persian'], $this->date_time ); |
|
77 | + $this->date_time = str_replace($this->config['month']['english'], $this->config['month']['persian'], $this->date_time); |
|
78 | 78 | |
79 | - $this->date_time = str_replace( $this->config['week_days_name']['english'], $this->config['week_days_name']['persian'][$this->gregorian_DayofWeek], $this->date_time ); |
|
79 | + $this->date_time = str_replace($this->config['week_days_name']['english'], $this->config['week_days_name']['persian'][$this->gregorian_DayofWeek], $this->date_time); |
|
80 | 80 | |
81 | - $this->date_time = str_replace( $this->english_number , $this->translate['number'], $this->date_time ); |
|
81 | + $this->date_time = str_replace($this->english_number, $this->translate['number'], $this->date_time); |
|
82 | 82 | |
83 | - $this->date_time = str_replace( $this->config['month']['persian'], $this->translate['month'], $this->date_time ); |
|
83 | + $this->date_time = str_replace($this->config['month']['persian'], $this->translate['month'], $this->date_time); |
|
84 | 84 | |
85 | - $this->date_time = str_replace( $this->config['week_days_name']['persian'], $this->translate['week_days_name'], $this->date_time ); |
|
85 | + $this->date_time = str_replace($this->config['week_days_name']['persian'], $this->translate['week_days_name'], $this->date_time); |
|
86 | 86 | |
87 | - $this->date_time = str_replace( 'th', 'ام', $this->date_time ); |
|
87 | + $this->date_time = str_replace('th', 'ام', $this->date_time); |
|
88 | 88 | |
89 | - $this->date_time = str_replace( 'AM', 'قبل از ظهر', $this->date_time ); |
|
89 | + $this->date_time = str_replace('AM', 'قبل از ظهر', $this->date_time); |
|
90 | 90 | |
91 | - $this->date_time = str_replace( 'am', 'ق.ظ', $this->date_time ); |
|
91 | + $this->date_time = str_replace('am', 'ق.ظ', $this->date_time); |
|
92 | 92 | |
93 | - $this->date_time = str_replace( 'PM', 'بعد از ظهر', $this->date_time ); |
|
93 | + $this->date_time = str_replace('PM', 'بعد از ظهر', $this->date_time); |
|
94 | 94 | |
95 | - $this->date_time = str_replace( 'pm', 'ب.ظ', $this->date_time ); |
|
95 | + $this->date_time = str_replace('pm', 'ب.ظ', $this->date_time); |
|
96 | 96 | |
97 | 97 | return $this->date_time; |
98 | 98 | |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | |
101 | 101 | protected function translateToArabic() { |
102 | 102 | |
103 | - $this->date_time = str_replace( $this->config['month']['english'], $this->config['month']['islamic'], $this->date_time ); |
|
103 | + $this->date_time = str_replace($this->config['month']['english'], $this->config['month']['islamic'], $this->date_time); |
|
104 | 104 | |
105 | - $this->date_time = str_replace( $this->config['week_days_name']['english'], $this->config['week_days_name']['islamic'][$this->gregorian_DayofWeek], $this->date_time ); |
|
105 | + $this->date_time = str_replace($this->config['week_days_name']['english'], $this->config['week_days_name']['islamic'][$this->gregorian_DayofWeek], $this->date_time); |
|
106 | 106 | |
107 | 107 | return $this->date_time; |
108 | 108 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | public function get() |
118 | 118 | { |
119 | - return $this->format( $this->calendar, $this->format ); |
|
119 | + return $this->format($this->calendar, $this->format); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 |
@@ -125,4 +125,4 @@ |
||
125 | 125 | */ |
126 | 126 | 'weekend' => array( 'friday' ) |
127 | 127 | |
128 | - ); |
|
128 | + ); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Datium\Datium as Datium; |
4 | 4 | |
5 | -return array ( |
|
5 | +return array( |
|
6 | 6 | |
7 | 7 | /************************************************************ |
8 | 8 | * Convert to |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | * |
13 | 13 | *\_________________________________________________________/ |
14 | 14 | */ |
15 | - 'convert_to' => function( $date_time ) { |
|
15 | + 'convert_to' => function($date_time) { |
|
16 | 16 | |
17 | - return Datium::create( $date_time )->sub( '226898 day' )->object(); |
|
17 | + return Datium::create($date_time)->sub('226898 day')->object(); |
|
18 | 18 | |
19 | 19 | }, |
20 | 20 | |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * |
27 | 27 | *\_________________________________________________________/ |
28 | 28 | */ |
29 | - 'convert_from' => function( $date_time ) { |
|
29 | + 'convert_from' => function($date_time) { |
|
30 | 30 | |
31 | - return Datium::create( $date_time )->add( '226898 day' )->object(); |
|
31 | + return Datium::create($date_time)->add('226898 day')->object(); |
|
32 | 32 | |
33 | 33 | }, |
34 | 34 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | *\_________________________________________________________/ |
52 | 52 | */ |
53 | - 'month' => array ( |
|
53 | + 'month' => array( |
|
54 | 54 | |
55 | 55 | 'Farvardin', |
56 | 56 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * |
88 | 88 | *\_________________________________________________________/ |
89 | 89 | */ |
90 | - 'days_of_week' => array ( |
|
90 | + 'days_of_week' => array( |
|
91 | 91 | |
92 | 92 | 'Shanbe', |
93 | 93 | |
@@ -123,6 +123,6 @@ discard block |
||
123 | 123 | * |
124 | 124 | *\_________________________________________________________/ |
125 | 125 | */ |
126 | - 'weekend' => array( 'friday' ) |
|
126 | + 'weekend' => array('friday') |
|
127 | 127 | |
128 | 128 | ); |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | |
26 | 26 | 'calendar' => array( |
27 | 27 | |
28 | - // iran |
|
28 | + // iran |
|
29 | 29 | 'ir', |
30 | 30 | |
31 | - // ghamari |
|
31 | + // ghamari |
|
32 | 32 | 'gh', |
33 | 33 | |
34 | - //gereogian |
|
34 | + //gereogian |
|
35 | 35 | 'gr' |
36 | 36 | |
37 | 37 | ), |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | |
50 | 50 | 'month' => array( |
51 | 51 | 'persian' => array( |
52 | - 'Farvardin', |
|
53 | - 'Ordibehesht', |
|
54 | - 'Khordad', |
|
55 | - 'Tir', |
|
56 | - 'Mordad' , |
|
57 | - 'Shahrivar', |
|
58 | - 'Mehr', |
|
59 | - 'Aban', |
|
60 | - 'Azar', |
|
61 | - 'Dey', |
|
62 | - 'Bahman', |
|
63 | - 'Esfand' ), |
|
52 | + 'Farvardin', |
|
53 | + 'Ordibehesht', |
|
54 | + 'Khordad', |
|
55 | + 'Tir', |
|
56 | + 'Mordad' , |
|
57 | + 'Shahrivar', |
|
58 | + 'Mehr', |
|
59 | + 'Aban', |
|
60 | + 'Azar', |
|
61 | + 'Dey', |
|
62 | + 'Bahman', |
|
63 | + 'Esfand' ), |
|
64 | 64 | |
65 | 65 | 'english' => array( |
66 | 66 | 'January', |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | 'October', |
76 | 76 | 'November', |
77 | 77 | 'December' |
78 | - ), |
|
78 | + ), |
|
79 | 79 | |
80 | 80 | 'islamic' => |
81 | 81 | array( 1 => 'Muharram', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'Shanbe' |
103 | 103 | ), |
104 | 104 | |
105 | - 'english' => array( |
|
105 | + 'english' => array( |
|
106 | 106 | 'Saturday', |
107 | 107 | 'Sunday', |
108 | 108 | 'Monday', |
@@ -112,56 +112,56 @@ discard block |
||
112 | 112 | 'Friday' |
113 | 113 | ), |
114 | 114 | |
115 | - 'islamic' => array( |
|
116 | - 'al-Aḥad', |
|
117 | - 'al-Ithnayn', |
|
118 | - 'ath-Thulatha\'', |
|
119 | - 'al-Arbi\'a', |
|
120 | - 'al-Khamees', |
|
121 | - 'al-Jumu\'ah', |
|
122 | - 'as-Sabt', |
|
115 | + 'islamic' => array( |
|
116 | + 'al-Aḥad', |
|
117 | + 'al-Ithnayn', |
|
118 | + 'ath-Thulatha\'', |
|
119 | + 'al-Arbi\'a', |
|
120 | + 'al-Khamees', |
|
121 | + 'al-Jumu\'ah', |
|
122 | + 'as-Sabt', |
|
123 | 123 | ) |
124 | 124 | |
125 | 125 | ), |
126 | 126 | 'shamsi_month_days' => array( 1 => 31, |
127 | - 2 => 31, |
|
128 | - 3 => 31, |
|
129 | - 4 => 31, |
|
130 | - 5 => 31, |
|
131 | - 6 => 31, |
|
132 | - 7 => 30, |
|
133 | - 8 => 30, |
|
134 | - 9 => 30, |
|
135 | - 10 => 30, |
|
136 | - 11 => 30, |
|
137 | - 12 => 29 ), |
|
127 | + 2 => 31, |
|
128 | + 3 => 31, |
|
129 | + 4 => 31, |
|
130 | + 5 => 31, |
|
131 | + 6 => 31, |
|
132 | + 7 => 30, |
|
133 | + 8 => 30, |
|
134 | + 9 => 30, |
|
135 | + 10 => 30, |
|
136 | + 11 => 30, |
|
137 | + 12 => 29 ), |
|
138 | 138 | |
139 | 139 | |
140 | 140 | 'gregorian_month_days' => array( 1 => 31, |
141 | - 2 => 28, |
|
142 | - 3 => 31, |
|
143 | - 4 => 30, |
|
144 | - 5 => 31, |
|
145 | - 6 => 30, |
|
146 | - 7 => 31, |
|
147 | - 8 => 31, |
|
148 | - 9 => 30, |
|
149 | - 10 => 31, |
|
150 | - 11 => 30, |
|
151 | - 12 => 30 ), |
|
141 | + 2 => 28, |
|
142 | + 3 => 31, |
|
143 | + 4 => 30, |
|
144 | + 5 => 31, |
|
145 | + 6 => 30, |
|
146 | + 7 => 31, |
|
147 | + 8 => 31, |
|
148 | + 9 => 30, |
|
149 | + 10 => 31, |
|
150 | + 11 => 30, |
|
151 | + 12 => 30 ), |
|
152 | 152 | |
153 | 153 | 'islamic_month_days' => array( 1 => 30, |
154 | - 2 => 29, |
|
155 | - 3 => 30, |
|
156 | - 4 => 30, |
|
157 | - 5 => 29, |
|
158 | - 6 => 29, |
|
159 | - 7 => 30, |
|
160 | - 8 => 29, |
|
161 | - 9 => 30, |
|
162 | - 10 => 29, |
|
163 | - 11 => 30, |
|
164 | - 12 => 30 ), |
|
154 | + 2 => 29, |
|
155 | + 3 => 30, |
|
156 | + 4 => 30, |
|
157 | + 5 => 29, |
|
158 | + 6 => 29, |
|
159 | + 7 => 30, |
|
160 | + 8 => 29, |
|
161 | + 9 => 30, |
|
162 | + 10 => 29, |
|
163 | + 11 => 30, |
|
164 | + 12 => 30 ), |
|
165 | 165 | |
166 | 166 | |
167 | 167 | 'date_interval' => array( 'D', 'M', 'Y', 'H', 'm', 'S' ), |
@@ -169,6 +169,6 @@ discard block |
||
169 | 169 | |
170 | 170 | 'date_simple' => array( 'day', ' month', ' year', ' hour', ' minute', ' second' ), |
171 | 171 | |
172 | - ); |
|
172 | + ); |
|
173 | 173 | |
174 | 174 | ?> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'Ordibehesht', |
54 | 54 | 'Khordad', |
55 | 55 | 'Tir', |
56 | - 'Mordad' , |
|
56 | + 'Mordad', |
|
57 | 57 | 'Shahrivar', |
58 | 58 | 'Mehr', |
59 | 59 | 'Aban', |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ), |
79 | 79 | |
80 | 80 | 'islamic' => |
81 | - array( 1 => 'Muharram', |
|
81 | + array(1 => 'Muharram', |
|
82 | 82 | 2 => 'Safar', |
83 | 83 | 3 => 'Rabi I', |
84 | 84 | 4 => 'Rabi II', |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 12 => 'Dhu al_Hijjah' |
93 | 93 | ) ), |
94 | 94 | |
95 | - 'week_days_name' => array( 'persian' => array( |
|
95 | + 'week_days_name' => array('persian' => array( |
|
96 | 96 | 'Yekshanbe', |
97 | 97 | 'Doshanbe', |
98 | 98 | 'Seshanbe', |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ) |
124 | 124 | |
125 | 125 | ), |
126 | - 'shamsi_month_days' => array( 1 => 31, |
|
126 | + 'shamsi_month_days' => array(1 => 31, |
|
127 | 127 | 2 => 31, |
128 | 128 | 3 => 31, |
129 | 129 | 4 => 31, |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | 9 => 30, |
135 | 135 | 10 => 30, |
136 | 136 | 11 => 30, |
137 | - 12 => 29 ), |
|
137 | + 12 => 29), |
|
138 | 138 | |
139 | 139 | |
140 | - 'gregorian_month_days' => array( 1 => 31, |
|
140 | + 'gregorian_month_days' => array(1 => 31, |
|
141 | 141 | 2 => 28, |
142 | 142 | 3 => 31, |
143 | 143 | 4 => 30, |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | 9 => 30, |
149 | 149 | 10 => 31, |
150 | 150 | 11 => 30, |
151 | - 12 => 30 ), |
|
151 | + 12 => 30), |
|
152 | 152 | |
153 | - 'islamic_month_days' => array( 1 => 30, |
|
153 | + 'islamic_month_days' => array(1 => 30, |
|
154 | 154 | 2 => 29, |
155 | 155 | 3 => 30, |
156 | 156 | 4 => 30, |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | 9 => 30, |
162 | 162 | 10 => 29, |
163 | 163 | 11 => 30, |
164 | - 12 => 30 ), |
|
164 | + 12 => 30), |
|
165 | 165 | |
166 | 166 | |
167 | - 'date_interval' => array( 'D', 'M', 'Y', 'H', 'm', 'S' ), |
|
167 | + 'date_interval' => array('D', 'M', 'Y', 'H', 'm', 'S'), |
|
168 | 168 | |
169 | 169 | |
170 | - 'date_simple' => array( 'day', ' month', ' year', ' hour', ' minute', ' second' ), |
|
170 | + 'date_simple' => array('day', ' month', ' year', ' hour', ' minute', ' second'), |
|
171 | 171 | |
172 | 172 | ); |
173 | 173 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @link http://www.un.org/en/sections/observances/international-days/ |
14 | 14 | */ |
15 | 15 | 'events' => array( |
16 | - 1 => array( 27 => 'International Day of Commemoration in Memory of the Victims of the Holocaust' ), |
|
16 | + 1 => array(27 => 'International Day of Commemoration in Memory of the Victims of the Holocaust'), |
|
17 | 17 | 2 => array( |
18 | 18 | 4 => 'World Cancer Day', |
19 | 19 | 6 => 'International Day of Zero Tolerance to Female Genital Mutilation', |