@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * Get current datetime |
184 | 184 | * |
185 | 185 | * @since Aug 17 2015 |
186 | - * @return object |
|
186 | + * @return Datium |
|
187 | 187 | */ |
188 | 188 | public static function now() |
189 | 189 | { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param integer $minute minute number |
205 | 205 | * @param integer $second second number |
206 | 206 | * |
207 | - * @return object |
|
207 | + * @return Datium |
|
208 | 208 | */ |
209 | 209 | public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) |
210 | 210 | { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param object $date_start Start of the DateTime |
244 | 244 | * @param object $date_end End of the DateTime |
245 | 245 | * |
246 | - * @return object |
|
246 | + * @return Datium |
|
247 | 247 | */ |
248 | 248 | public static function between( $date_start, $date_end ) |
249 | 249 | { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @param object $calendar Assigned calendar to when calendar should start. |
291 | 291 | * |
292 | - * @return object |
|
292 | + * @return Datium |
|
293 | 293 | */ |
294 | 294 | public function to( $calendar ) |
295 | 295 | { |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @param string $value How much date should be added to current date |
332 | 332 | * |
333 | - * @return object |
|
333 | + * @return Datium |
|
334 | 334 | */ |
335 | 335 | public function add( $value ) |
336 | 336 | { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @param string $value How much date should increase from current date |
362 | 362 | * |
363 | - * @return obejct |
|
363 | + * @return Datium |
|
364 | 364 | */ |
365 | 365 | public function sub( $value ) |
366 | 366 | { |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @param string $type Name of the calendar to caculate leap year |
392 | 392 | * |
393 | - * @return boolean |
|
393 | + * @return Leap |
|
394 | 394 | */ |
395 | 395 | public function leap( $type = 'gregorian' ) |
396 | 396 | { |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @since Aug, 22 2015 |
408 | 408 | * |
409 | - * @return integer |
|
409 | + * @return DayOf |
|
410 | 410 | */ |
411 | 411 | public function dayOf() |
412 | 412 | { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * |
454 | 454 | * @param string $language language short name fa, en, ar ... |
455 | 455 | * |
456 | - * @return object |
|
456 | + * @return Datium |
|
457 | 457 | */ |
458 | 458 | public function lang( $language = 'fa' ) |
459 | 459 | { |
@@ -18,7 +18,6 @@ |
||
18 | 18 | use OpenCafe\Tools\Leap; |
19 | 19 | use OpenCafe\Tools\DayOf; |
20 | 20 | use OpenCafe\Tools\Lang; |
21 | - |
|
22 | 21 | use OpenCafe\Datium; |
23 | 22 | |
24 | 23 | /** |
@@ -35,17 +35,17 @@ discard block |
||
35 | 35 | { |
36 | 36 | |
37 | 37 | /** |
38 | - * Store DateTime object |
|
39 | - */ |
|
38 | + * Store DateTime object |
|
39 | + */ |
|
40 | 40 | protected $date_time; |
41 | 41 | |
42 | 42 | protected static $static_date_time; |
43 | 43 | |
44 | 44 | /** |
45 | - * Store config file statements |
|
46 | - * |
|
47 | - * @param array |
|
48 | - */ |
|
45 | + * Store config file statements |
|
46 | + * |
|
47 | + * @param array |
|
48 | + */ |
|
49 | 49 | protected $config; |
50 | 50 | |
51 | 51 | protected $date_interval_expression; |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | protected $fromConfig; |
64 | 64 | |
65 | 65 | /** |
66 | - * Return store day number |
|
67 | - * |
|
68 | - * @param integer |
|
69 | - */ |
|
66 | + * Return store day number |
|
67 | + * |
|
68 | + * @param integer |
|
69 | + */ |
|
70 | 70 | protected $day_of; |
71 | 71 | |
72 | 72 | protected $leap; |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | protected $language; |
93 | 93 | |
94 | 94 | /** |
95 | - * Datium class constructure |
|
96 | - */ |
|
95 | + * Datium class constructure |
|
96 | + */ |
|
97 | 97 | public function __construct() |
98 | 98 | { |
99 | 99 | |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | - * Return all datetime parts as an object |
|
158 | - * |
|
159 | - * @return object |
|
160 | - */ |
|
157 | + * Return all datetime parts as an object |
|
158 | + * |
|
159 | + * @return object |
|
160 | + */ |
|
161 | 161 | public function all() |
162 | 162 | { |
163 | 163 | |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * Get current datetime |
|
184 | - * |
|
185 | - * @since Aug 17 2015 |
|
186 | - * @return object |
|
187 | - */ |
|
183 | + * Get current datetime |
|
184 | + * |
|
185 | + * @since Aug 17 2015 |
|
186 | + * @return object |
|
187 | + */ |
|
188 | 188 | public static function now() |
189 | 189 | { |
190 | 190 | |
@@ -195,23 +195,23 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Create new date time |
|
199 | - * |
|
200 | - * @param integer $year Year number |
|
201 | - * @param integer $month month number |
|
202 | - * @param integer $day day number |
|
203 | - * @param integer $hour hour number |
|
204 | - * @param integer $minute minute number |
|
205 | - * @param integer $second second number |
|
206 | - * |
|
207 | - * @return object |
|
208 | - */ |
|
198 | + * Create new date time |
|
199 | + * |
|
200 | + * @param integer $year Year number |
|
201 | + * @param integer $month month number |
|
202 | + * @param integer $day day number |
|
203 | + * @param integer $hour hour number |
|
204 | + * @param integer $minute minute number |
|
205 | + * @param integer $second second number |
|
206 | + * |
|
207 | + * @return object |
|
208 | + */ |
|
209 | 209 | public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) |
210 | 210 | { |
211 | 211 | |
212 | 212 | /** |
213 | - * When we want to set a Datetime object to Datium |
|
214 | - */ |
|
213 | + * When we want to set a Datetime object to Datium |
|
214 | + */ |
|
215 | 215 | if(func_num_args() === 1 ) { |
216 | 216 | |
217 | 217 | self::$static_date_time = func_get_arg(0); |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
241 | - * Select The range between two date object |
|
242 | - * |
|
243 | - * @param object $date_start Start of the DateTime |
|
244 | - * @param object $date_end End of the DateTime |
|
245 | - * |
|
246 | - * @return object |
|
247 | - */ |
|
241 | + * Select The range between two date object |
|
242 | + * |
|
243 | + * @param object $date_start Start of the DateTime |
|
244 | + * @param object $date_end End of the DateTime |
|
245 | + * |
|
246 | + * @return object |
|
247 | + */ |
|
248 | 248 | public static function between( $date_start, $date_end ) |
249 | 249 | { |
250 | 250 | |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
262 | - * Convert from current calendar, what type is current calendar? |
|
263 | - * |
|
264 | - * @param object $calendar Assigned calendar to start from |
|
265 | - * |
|
266 | - * @return $object |
|
267 | - */ |
|
262 | + * Convert from current calendar, what type is current calendar? |
|
263 | + * |
|
264 | + * @param object $calendar Assigned calendar to start from |
|
265 | + * |
|
266 | + * @return $object |
|
267 | + */ |
|
268 | 268 | public function from( $calendar ) |
269 | 269 | { |
270 | 270 | |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | |
275 | 275 | |
276 | 276 | /** |
277 | - * We need this part for DayOf class |
|
278 | - */ |
|
277 | + * We need this part for DayOf class |
|
278 | + */ |
|
279 | 279 | $this->calendar_type = $calendar; |
280 | 280 | |
281 | 281 | $this->translate_to = $calendar; |
@@ -285,12 +285,12 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
288 | - * Convert date to current Date |
|
289 | - * |
|
290 | - * @param object $calendar Assigned calendar to when calendar should start. |
|
291 | - * |
|
292 | - * @return object |
|
293 | - */ |
|
288 | + * Convert date to current Date |
|
289 | + * |
|
290 | + * @param object $calendar Assigned calendar to when calendar should start. |
|
291 | + * |
|
292 | + * @return object |
|
293 | + */ |
|
294 | 294 | public function to( $calendar ) |
295 | 295 | { |
296 | 296 | |
@@ -299,8 +299,8 @@ discard block |
||
299 | 299 | $this->date_time = $this->convert->to($calendar); |
300 | 300 | |
301 | 301 | /** |
302 | - * We need this part for DayOf class |
|
303 | - */ |
|
302 | + * We need this part for DayOf class |
|
303 | + */ |
|
304 | 304 | $this->calendar_type = $calendar; |
305 | 305 | |
306 | 306 | $this->translate_to = $calendar; |
@@ -311,13 +311,13 @@ discard block |
||
311 | 311 | |
312 | 312 | |
313 | 313 | /** |
314 | - * Difference between two time |
|
315 | - * |
|
316 | - * @param DateTime $start Start of the date |
|
317 | - * @param DateTime $end End of the date |
|
318 | - * |
|
319 | - * @return object |
|
320 | - */ |
|
314 | + * Difference between two time |
|
315 | + * |
|
316 | + * @param DateTime $start Start of the date |
|
317 | + * @param DateTime $end End of the date |
|
318 | + * |
|
319 | + * @return object |
|
320 | + */ |
|
321 | 321 | public static function diff( $start, $end ) |
322 | 322 | { |
323 | 323 | |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
329 | - * Add new date value to current date |
|
330 | - * |
|
331 | - * @param string $value How much date should be added to current date |
|
332 | - * |
|
333 | - * @return object |
|
334 | - */ |
|
329 | + * Add new date value to current date |
|
330 | + * |
|
331 | + * @param string $value How much date should be added to current date |
|
332 | + * |
|
333 | + * @return object |
|
334 | + */ |
|
335 | 335 | public function add( $value ) |
336 | 336 | { |
337 | 337 | |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
359 | - * Sub date from current date |
|
360 | - * |
|
361 | - * @param string $value How much date should increase from current date |
|
362 | - * |
|
363 | - * @return obejct |
|
364 | - */ |
|
359 | + * Sub date from current date |
|
360 | + * |
|
361 | + * @param string $value How much date should increase from current date |
|
362 | + * |
|
363 | + * @return obejct |
|
364 | + */ |
|
365 | 365 | public function sub( $value ) |
366 | 366 | { |
367 | 367 | |
@@ -386,12 +386,12 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
389 | - * Check if current year is leap or not |
|
390 | - * |
|
391 | - * @param string $type Name of the calendar to caculate leap year |
|
392 | - * |
|
393 | - * @return boolean |
|
394 | - */ |
|
389 | + * Check if current year is leap or not |
|
390 | + * |
|
391 | + * @param string $type Name of the calendar to caculate leap year |
|
392 | + * |
|
393 | + * @return boolean |
|
394 | + */ |
|
395 | 395 | public function leap( $type = 'gregorian' ) |
396 | 396 | { |
397 | 397 | |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
405 | - * Caculate day of year or week |
|
406 | - * |
|
407 | - * @since Aug, 22 2015 |
|
408 | - * |
|
409 | - * @return integer |
|
410 | - */ |
|
405 | + * Caculate day of year or week |
|
406 | + * |
|
407 | + * @since Aug, 22 2015 |
|
408 | + * |
|
409 | + * @return integer |
|
410 | + */ |
|
411 | 411 | public function dayOf() |
412 | 412 | { |
413 | 413 | |
@@ -435,12 +435,12 @@ discard block |
||
435 | 435 | // } |
436 | 436 | |
437 | 437 | /** |
438 | - * Return Datetime as a original object |
|
439 | - * |
|
440 | - * @since Oct 22, 2015 |
|
441 | - * |
|
442 | - * @return object |
|
443 | - */ |
|
438 | + * Return Datetime as a original object |
|
439 | + * |
|
440 | + * @since Oct 22, 2015 |
|
441 | + * |
|
442 | + * @return object |
|
443 | + */ |
|
444 | 444 | public function object() |
445 | 445 | { |
446 | 446 | |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
452 | - * Translate current date string to selected language |
|
453 | - * |
|
454 | - * @param string $language language short name fa, en, ar ... |
|
455 | - * |
|
456 | - * @return object |
|
457 | - */ |
|
452 | + * Translate current date string to selected language |
|
453 | + * |
|
454 | + * @param string $language language short name fa, en, ar ... |
|
455 | + * |
|
456 | + * @return object |
|
457 | + */ |
|
458 | 458 | public function lang( $language = 'fa' ) |
459 | 459 | { |
460 | 460 | |
@@ -471,14 +471,14 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
474 | - * Return fainal result |
|
475 | - * |
|
476 | - * @param string $format Date format |
|
477 | - * |
|
478 | - * @since Aug 17 2015 |
|
479 | - * |
|
480 | - * @return string |
|
481 | - */ |
|
474 | + * Return fainal result |
|
475 | + * |
|
476 | + * @param string $format Date format |
|
477 | + * |
|
478 | + * @since Aug 17 2015 |
|
479 | + * |
|
480 | + * @return string |
|
481 | + */ |
|
482 | 482 | public function get( $format = 'Y-m-d H:i:s' ) |
483 | 483 | { |
484 | 484 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | if (is_null($this->toConfig) ) { |
498 | 498 | |
499 | 499 | $this->toConfig = include 'CalendarSettings/' . |
500 | - ucfirst($this->translate_to) . '.php'; |
|
500 | + ucfirst($this->translate_to) . '.php'; |
|
501 | 501 | |
502 | 502 | } |
503 | 503 |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | |
106 | 106 | $this->config = include 'Config.php'; |
107 | 107 | |
108 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
108 | + $this->calendar_type = $this->config['default_calendar']; |
|
109 | 109 | |
110 | - date_default_timezone_set($this->config[ 'timezone' ]); |
|
110 | + date_default_timezone_set($this->config['timezone']); |
|
111 | 111 | |
112 | 112 | $this->calendar_type = 'gregorian'; |
113 | 113 | |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | $this->date_time = new DateTime('now'); |
124 | 124 | |
125 | 125 | $this->date_time->setDate( |
126 | - self::$array_date[ 'year' ], |
|
127 | - self::$array_date[ 'month' ], |
|
128 | - self::$array_date[ 'day' ] |
|
126 | + self::$array_date['year'], |
|
127 | + self::$array_date['month'], |
|
128 | + self::$array_date['day'] |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $this->date_time->setTime( |
132 | - self::$array_date[ 'hour' ], |
|
133 | - self::$array_date[ 'minute' ], |
|
134 | - self::$array_date[ 'second' ] |
|
132 | + self::$array_date['hour'], |
|
133 | + self::$array_date['minute'], |
|
134 | + self::$array_date['second'] |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public function all() |
157 | 157 | { |
158 | 158 | |
159 | - return ( object ) array( |
|
159 | + return (object) array( |
|
160 | 160 | |
161 | 161 | 'second' => $this->date_time->format('s'), |
162 | 162 | |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | { |
328 | 328 | |
329 | 329 | $this->date_interval_expression = str_replace( |
330 | - $this->config[ 'date_simple' ], |
|
331 | - $this->config[ 'date_interval' ], |
|
330 | + $this->config['date_simple'], |
|
331 | + $this->config['date_interval'], |
|
332 | 332 | $value |
333 | 333 | ); |
334 | 334 | |
335 | 335 | $this->date_interval_expression = str_replace( |
336 | 336 | ' ', |
337 | 337 | '', |
338 | - 'P' . $this->date_interval_expression |
|
338 | + 'P'.$this->date_interval_expression |
|
339 | 339 | ); |
340 | 340 | |
341 | 341 | $this->date_time->add( |
@@ -357,15 +357,15 @@ discard block |
||
357 | 357 | { |
358 | 358 | |
359 | 359 | $this->date_interval_expression = str_replace( |
360 | - $this->config[ 'date_simple' ], |
|
361 | - $this->config[ 'date_interval' ], |
|
360 | + $this->config['date_simple'], |
|
361 | + $this->config['date_interval'], |
|
362 | 362 | $value |
363 | 363 | ); |
364 | 364 | |
365 | 365 | $this->date_interval_expression = str_replace( |
366 | 366 | ' ', |
367 | 367 | '', |
368 | - 'P' . $this->date_interval_expression |
|
368 | + 'P'.$this->date_interval_expression |
|
369 | 369 | ); |
370 | 370 | |
371 | 371 | $this->date_time->sub( |
@@ -478,52 +478,52 @@ discard block |
||
478 | 478 | // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
479 | 479 | |
480 | 480 | if (is_null($this->fromConfig)) { |
481 | - $this->fromConfig = include 'CalendarSettings/' . |
|
482 | - ucfirst($this->translate_from) . '.php'; |
|
481 | + $this->fromConfig = include 'CalendarSettings/'. |
|
482 | + ucfirst($this->translate_from).'.php'; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | |
486 | 486 | if (is_null($this->toConfig)) { |
487 | - $this->toConfig = include 'CalendarSettings/' . |
|
488 | - ucfirst($this->translate_to) . '.php'; |
|
487 | + $this->toConfig = include 'CalendarSettings/'. |
|
488 | + ucfirst($this->translate_to).'.php'; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | $string_date = $this->date_time->format($format); |
492 | 492 | |
493 | 493 | if ($this->translate_to != 'gregorian') { |
494 | 494 | $string_date = str_replace( |
495 | - $this->fromConfig[ 'month' ], |
|
496 | - $this->toConfig[ 'month' ], |
|
495 | + $this->fromConfig['month'], |
|
496 | + $this->toConfig['month'], |
|
497 | 497 | $string_date |
498 | 498 | ); |
499 | 499 | |
500 | 500 | $string_date = str_replace( |
501 | - $this->fromConfig[ 'days_of_week' ], |
|
502 | - $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ], |
|
501 | + $this->fromConfig['days_of_week'], |
|
502 | + $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], |
|
503 | 503 | $string_date |
504 | 504 | ); |
505 | 505 | |
506 | 506 | $string_date = str_replace( |
507 | - $this->fromConfig[ 'numbers' ], |
|
508 | - $this->toConfig[ 'numbers' ], |
|
507 | + $this->fromConfig['numbers'], |
|
508 | + $this->toConfig['numbers'], |
|
509 | 509 | $string_date |
510 | 510 | ); |
511 | 511 | |
512 | 512 | $string_date = str_replace( |
513 | - $this->fromConfig[ 'am_time' ], |
|
514 | - $this->toConfig[ 'am_time' ], |
|
513 | + $this->fromConfig['am_time'], |
|
514 | + $this->toConfig['am_time'], |
|
515 | 515 | $string_date |
516 | 516 | ); |
517 | 517 | |
518 | 518 | $string_date = str_replace( |
519 | - $this->fromConfig[ 'pm_time' ], |
|
520 | - $this->toConfig[ 'pm_time' ], |
|
519 | + $this->fromConfig['pm_time'], |
|
520 | + $this->toConfig['pm_time'], |
|
521 | 521 | $string_date |
522 | 522 | ); |
523 | 523 | |
524 | 524 | $string_date = str_replace( |
525 | - $this->fromConfig[ 'end_of_days' ], |
|
526 | - $this->toConfig[ 'end_of_days' ], |
|
525 | + $this->fromConfig['end_of_days'], |
|
526 | + $this->toConfig['end_of_days'], |
|
527 | 527 | $string_date |
528 | 528 | ); |
529 | 529 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | - * Which day of year is current day. |
|
38 | - * |
|
39 | - * @since Aug, 03 2015 |
|
40 | - * @return integer |
|
41 | - */ |
|
37 | + * Which day of year is current day. |
|
38 | + * |
|
39 | + * @since Aug, 03 2015 |
|
40 | + * @return integer |
|
41 | + */ |
|
42 | 42 | public function year() |
43 | 43 | { |
44 | 44 | |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | /** |
53 | - * Which day of week is current day. |
|
54 | - * |
|
55 | - * @since Aug, 09 2015 |
|
56 | - * @return integer |
|
57 | - */ |
|
53 | + * Which day of week is current day. |
|
54 | + * |
|
55 | + * @since Aug, 09 2015 |
|
56 | + * @return integer |
|
57 | + */ |
|
58 | 58 | public function week() |
59 | 59 | { |
60 | 60 |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | public function year() |
43 | 43 | { |
44 | 44 | |
45 | - $this->config = include 'CalendarSettings/' . ucfirst($this->calendar_type) . '.php'; |
|
45 | + $this->config = include 'CalendarSettings/'.ucfirst($this->calendar_type).'.php'; |
|
46 | 46 | |
47 | - return $this->config[ 'day_of_year' ]( $this->date_time ); |
|
47 | + return $this->config['day_of_year']($this->date_time); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | public function week() |
59 | 59 | { |
60 | 60 | |
61 | - $this->config = include 'CalendarSettings/' . ucfirst($this->calendar_type) . '.php'; |
|
61 | + $this->config = include 'CalendarSettings/'.ucfirst($this->calendar_type).'.php'; |
|
62 | 62 | |
63 | - return $this->config[ 'day_of_week' ]( $this->date_time ); |
|
63 | + return $this->config['day_of_week']($this->date_time); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | } |
49 | 49 | |
50 | - $temp_day += $day; |
|
50 | + $temp_day += $day; |
|
51 | 51 | |
52 | - $leap = new Leap($year); |
|
52 | + $leap = new Leap($year); |
|
53 | 53 | |
54 | 54 | if ($leap->get() && $month > 2 ) { $temp_day++; |
55 | 55 | } |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - $date_time->setDate($year, $month, $day); |
|
137 | + $date_time->setDate($year, $month, $day); |
|
138 | 138 | |
139 | - return $date_time; |
|
139 | + return $date_time; |
|
140 | 140 | |
141 | 141 | }, |
142 | 142 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
209 | 209 | |
210 | 210 | |
211 | - return $date_time; |
|
211 | + return $date_time; |
|
212 | 212 | |
213 | 213 | }, |
214 | 214 | |
@@ -271,30 +271,30 @@ discard block |
||
271 | 271 | |
272 | 272 | 'days_of_week' => array ( |
273 | 273 | |
274 | - 'Yekshanbe', |
|
275 | - 'Doshanbe', |
|
276 | - 'Seshanbe', |
|
277 | - 'Chaharshanbe', |
|
278 | - 'Panjshanbe', |
|
279 | - 'Jome', |
|
280 | - 'Shanbe', |
|
274 | + 'Yekshanbe', |
|
275 | + 'Doshanbe', |
|
276 | + 'Seshanbe', |
|
277 | + 'Chaharshanbe', |
|
278 | + 'Panjshanbe', |
|
279 | + 'Jome', |
|
280 | + 'Shanbe', |
|
281 | 281 | |
282 | 282 | ), |
283 | 283 | |
284 | 284 | 'start_day_of_week' => 'Shanbe', |
285 | 285 | |
286 | 286 | 'month_days_number' => array( 1 => 31, |
287 | - 2 => 31, |
|
288 | - 3 => 31, |
|
289 | - 4 => 31, |
|
290 | - 5 => 31, |
|
291 | - 6 => 31, |
|
292 | - 7 => 30, |
|
293 | - 8 => 30, |
|
294 | - 9 => 30, |
|
295 | - 10 => 30, |
|
296 | - 11 => 30, |
|
297 | - 12 => 29 ), |
|
287 | + 2 => 31, |
|
288 | + 3 => 31, |
|
289 | + 4 => 31, |
|
290 | + 5 => 31, |
|
291 | + 6 => 31, |
|
292 | + 7 => 30, |
|
293 | + 8 => 30, |
|
294 | + 9 => 30, |
|
295 | + 10 => 30, |
|
296 | + 11 => 30, |
|
297 | + 12 => 29 ), |
|
298 | 298 | |
299 | 299 | /************************************************************ |
300 | 300 | * Day of year |
@@ -378,4 +378,4 @@ discard block |
||
378 | 378 | */ |
379 | 379 | 'weekend' => array( 'friday' ) |
380 | 380 | |
381 | - ); |
|
381 | + ); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use OpenCafe\Datium as Datium; |
4 | 4 | use OpenCafe\Tools\Leap as Leap; |
5 | 5 | |
6 | -return array ( |
|
6 | +return array( |
|
7 | 7 | |
8 | 8 | 'timezone' => 'Asia/Tehran', |
9 | 9 | |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | |
12 | 12 | 'events' => array(), |
13 | 13 | |
14 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
14 | + 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
15 | 15 | |
16 | 16 | 'am_time' => 'AM', |
17 | 17 | |
18 | 18 | 'pm_time' => 'PM', |
19 | 19 | |
20 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
20 | + 'end_of_days' => array('th', 'st', 'nd', 'rd'), |
|
21 | 21 | |
22 | 22 | |
23 | 23 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | *\_________________________________________________________/ |
31 | 31 | */ |
32 | - 'convert_to' => function ($date_time) { |
|
32 | + 'convert_to' => function($date_time) { |
|
33 | 33 | |
34 | 34 | $config = include 'Gregorian.php'; |
35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $temp_day = 0; |
43 | 43 | |
44 | 44 | for ($i = 1; $i < $month; $i++) { |
45 | - $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
45 | + $temp_day += $config['month_days_number'][$i]; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $temp_day += $day; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($temp_day <= 79) { |
57 | - if (( $year - 1 ) % 4 == 0) { |
|
57 | + if (($year - 1) % 4 == 0) { |
|
58 | 58 | $temp_day = $temp_day + 11; |
59 | 59 | } else { |
60 | 60 | $temp_day = $temp_day + 10; |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | $year = $year - 622; |
64 | 64 | |
65 | 65 | if ($temp_day % 30 == 0) { |
66 | - $month = ( $temp_day / 30 ) + 9; |
|
66 | + $month = ($temp_day / 30) + 9; |
|
67 | 67 | |
68 | 68 | $day = 30; |
69 | 69 | } else { |
70 | - $month = ( $temp_day / 30 ) + 10; |
|
70 | + $month = ($temp_day / 30) + 10; |
|
71 | 71 | |
72 | 72 | $day = $temp_day % 30; |
73 | 73 | } |
@@ -78,23 +78,23 @@ discard block |
||
78 | 78 | |
79 | 79 | if ($temp_day <= 186) { |
80 | 80 | if ($temp_day % 31 == 0) { |
81 | - $month = ( $temp_day / 31 ); |
|
81 | + $month = ($temp_day / 31); |
|
82 | 82 | |
83 | 83 | $day = 31; |
84 | 84 | } else { |
85 | - $month = ( $temp_day / 31 ) + 1; |
|
85 | + $month = ($temp_day / 31) + 1; |
|
86 | 86 | |
87 | - $day = ( $temp_day % 31 ); |
|
87 | + $day = ($temp_day % 31); |
|
88 | 88 | } |
89 | 89 | } else { |
90 | 90 | $temp_day = $temp_day - 186; |
91 | 91 | |
92 | 92 | if ($temp_day % 30 == 0) { |
93 | - $month = ( $temp_day / 30 ) + 6; |
|
93 | + $month = ($temp_day / 30) + 6; |
|
94 | 94 | |
95 | 95 | $day = 30; |
96 | 96 | } else { |
97 | - $month = ( $temp_day / 30 ) + 7; |
|
97 | + $month = ($temp_day / 30) + 7; |
|
98 | 98 | |
99 | 99 | $day = $temp_day % 30; |
100 | 100 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * |
116 | 116 | *\_________________________________________________________/ |
117 | 117 | */ |
118 | - 'convert_from' => function ($date_time) { |
|
118 | + 'convert_from' => function($date_time) { |
|
119 | 119 | |
120 | 120 | $config = include 'Jalali.php'; |
121 | 121 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | $days_of_year = 0; |
129 | 129 | |
130 | - foreach ($config[ 'month_days_number' ] as $mon => $value) { |
|
130 | + foreach ($config['month_days_number'] as $mon => $value) { |
|
131 | 131 | if ($month > $mon) { |
132 | 132 | $days_of_year += $value; |
133 | 133 | } |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | |
136 | 136 | $days_of_year += $day; |
137 | 137 | |
138 | - $days_of_leap_years = intval(( ( $year - 1 ) / 4 )); |
|
138 | + $days_of_leap_years = intval((($year - 1) / 4)); |
|
139 | 139 | |
140 | - $days_of_shamsi_years = ( ( ( $year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years ); |
|
140 | + $days_of_shamsi_years = ((($year - 1) * 365) + $days_of_year + $days_of_leap_years); |
|
141 | 141 | |
142 | 142 | $days_of_gregorain_years = $days_of_shamsi_years + 226899; |
143 | 143 | |
144 | 144 | if ($month < 10) { |
145 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 621 ) / 4 )); |
|
146 | - } elseif (( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 )) { |
|
147 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 622 ) / 4 )); |
|
145 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 621) / 4)); |
|
146 | + } elseif (((10 == $month) && ($day > 10)) || ($month > 10)) { |
|
147 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 622) / 4)); |
|
148 | 148 | } |
149 | 149 | |
150 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
150 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
151 | 151 | |
152 | 152 | $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
153 | 153 | |
154 | 154 | $config = include 'Gregorian.php'; |
155 | 155 | |
156 | - foreach ($config[ 'month_days_number' ] as $month => $value) { |
|
156 | + foreach ($config['month_days_number'] as $month => $value) { |
|
157 | 157 | if ($gregorian_month < $value) { |
158 | 158 | break; |
159 | 159 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | *\_________________________________________________________/ |
192 | 192 | */ |
193 | - 'month' => array ( |
|
193 | + 'month' => array( |
|
194 | 194 | |
195 | 195 | 'Farvardin', |
196 | 196 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | |
231 | 231 | |
232 | - 'days_of_week' => array ( |
|
232 | + 'days_of_week' => array( |
|
233 | 233 | |
234 | 234 | 'Yekshanbe', |
235 | 235 | 'Doshanbe', |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | 'start_day_of_week' => 'Shanbe', |
245 | 245 | |
246 | - 'month_days_number' => array( 1 => 31, |
|
246 | + 'month_days_number' => array(1 => 31, |
|
247 | 247 | 2 => 31, |
248 | 248 | 3 => 31, |
249 | 249 | 4 => 31, |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | 9 => 30, |
255 | 255 | 10 => 30, |
256 | 256 | 11 => 30, |
257 | - 12 => 29 ), |
|
257 | + 12 => 29), |
|
258 | 258 | |
259 | 259 | /************************************************************ |
260 | 260 | * Day of year |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * |
265 | 265 | *\_________________________________________________________/ |
266 | 266 | */ |
267 | - 'day_of_year' => function ($date_time) { |
|
267 | + 'day_of_year' => function($date_time) { |
|
268 | 268 | |
269 | 269 | $result = null; |
270 | 270 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | $day = $date_time->format('d'); |
276 | 276 | |
277 | - foreach ($config[ 'month_days_number' ] as $_month => $value) { |
|
277 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
278 | 278 | if ($_month < $month) { |
279 | 279 | $result += $value; |
280 | 280 | } |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | * example : Yekshanbe = result is 2 |
295 | 295 | *\_________________________________________________________/ |
296 | 296 | */ |
297 | - 'day_of_week' => function ($date_time) { |
|
297 | + 'day_of_week' => function($date_time) { |
|
298 | 298 | |
299 | - $days = array( 1 => 'Shanbe', 2 => 'Yekshanbe', 3 => 'Doshanbe', 4 => 'Seshanbe', 5 => 'Chaharshanbe', 6 => 'Panjshanbe', 7 => 'Jome' ); |
|
299 | + $days = array(1 => 'Shanbe', 2 => 'Yekshanbe', 3 => 'Doshanbe', 4 => 'Seshanbe', 5 => 'Chaharshanbe', 6 => 'Panjshanbe', 7 => 'Jome'); |
|
300 | 300 | |
301 | 301 | $configShamsi = include 'Jalali.php'; |
302 | 302 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | $day = $date_time->format('l'); |
306 | 306 | |
307 | - $day = str_replace($configGregorian[ 'days_of_week' ], $configShamsi[ 'days_of_week' ], $day); |
|
307 | + $day = str_replace($configGregorian['days_of_week'], $configShamsi['days_of_week'], $day); |
|
308 | 308 | |
309 | 309 | foreach ($days as $key => $value) { |
310 | 310 | if ($day == $value) { |
@@ -332,6 +332,6 @@ discard block |
||
332 | 332 | * |
333 | 333 | *\_________________________________________________________/ |
334 | 334 | */ |
335 | - 'weekend' => array( 'friday' ) |
|
335 | + 'weekend' => array('friday') |
|
336 | 336 | |
337 | 337 | ); |
@@ -42,13 +42,13 @@ |
||
42 | 42 | { |
43 | 43 | |
44 | 44 | /** |
45 | - * Fetch translated file to config attribute |
|
46 | - */ |
|
45 | + * Fetch translated file to config attribute |
|
46 | + */ |
|
47 | 47 | self::$config = include 'src/CalendarSettings/Jalali.php'; |
48 | 48 | |
49 | 49 | /** |
50 | - * Fetch translated expression to langTable attribute |
|
51 | - */ |
|
50 | + * Fetch translated expression to langTable attribute |
|
51 | + */ |
|
52 | 52 | self::$langTable = include 'lang/' . $language . '/general.php'; |
53 | 53 | |
54 | 54 | foreach( self::$langTable as $key => $translate ){ |
@@ -49,12 +49,12 @@ |
||
49 | 49 | /** |
50 | 50 | * Fetch translated expression to langTable attribute |
51 | 51 | */ |
52 | - self::$langTable = include 'lang/' . $language . '/general.php'; |
|
52 | + self::$langTable = include 'lang/'.$language.'/general.php'; |
|
53 | 53 | |
54 | 54 | foreach (self::$langTable as $key => $translate) { |
55 | - if (isset(self::$config[ $key ])) { |
|
56 | - if (self::$config[ $key ]) { |
|
57 | - self::$config[ $key ] = $translate; |
|
55 | + if (isset(self::$config[$key])) { |
|
56 | + if (self::$config[$key]) { |
|
57 | + self::$config[$key] = $translate; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | use OpenCafe\Datium as Datium; |
4 | 4 | use OpenCafe\Tools\Leap as Leap; |
5 | 5 | |
6 | - return array ( |
|
6 | + return array ( |
|
7 | 7 | |
8 | - /************************************************************ |
|
8 | + /************************************************************ |
|
9 | 9 | * Convert to |
10 | 10 | ************************************************************ |
11 | 11 | * |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | * |
14 | 14 | *\_________________________________________________________/ |
15 | 15 | */ |
16 | - 'convert_to' => function ($date_time) { |
|
16 | + 'convert_to' => function ($date_time) { |
|
17 | 17 | |
18 | - $config = include 'Jalali.php'; |
|
18 | + $config = include 'Jalali.php'; |
|
19 | 19 | |
20 | - $date_time = Datium::create($date_time)->to('jalali')->object(); |
|
20 | + $date_time = Datium::create($date_time)->to('jalali')->object(); |
|
21 | 21 | |
22 | - $year = $date_time->format('Y'); |
|
22 | + $year = $date_time->format('Y'); |
|
23 | 23 | |
24 | - $month = $date_time->format('n'); |
|
24 | + $month = $date_time->format('n'); |
|
25 | 25 | |
26 | - $day = $date_time->format('d'); |
|
26 | + $day = $date_time->format('d'); |
|
27 | 27 | |
28 | - $temp_day = 0 ; |
|
28 | + $temp_day = 0 ; |
|
29 | 29 | |
30 | 30 | for ($i = 1; $i < $month; $i++) { |
31 | 31 | $temp_day += $config[ 'month_days_number' ][ $i ]; |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | $temp_day++; |
40 | 40 | } |
41 | 41 | |
42 | - $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
42 | + $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
43 | 43 | |
44 | - $_year = explode('.', $_year); |
|
44 | + $_year = explode('.', $_year); |
|
45 | 45 | |
46 | - $year = $_year[0]; |
|
46 | + $year = $_year[0]; |
|
47 | 47 | |
48 | - $_month = $_year[1]; |
|
48 | + $_month = $_year[1]; |
|
49 | 49 | |
50 | 50 | $var_temp = '0.0'; |
51 | 51 | |
@@ -55,37 +55,37 @@ discard block |
||
55 | 55 | |
56 | 56 | $var_temp .= '1'; |
57 | 57 | |
58 | - $_month = $_month * $var_temp ; |
|
58 | + $_month = $_month * $var_temp ; |
|
59 | 59 | |
60 | - $_month = ( $_month * 12 ) + 1; |
|
60 | + $_month = ( $_month * 12 ) + 1; |
|
61 | 61 | |
62 | - $_month = explode('.', $_month); |
|
62 | + $_month = explode('.', $_month); |
|
63 | 63 | |
64 | - $month = $_month[0]; |
|
64 | + $month = $_month[0]; |
|
65 | 65 | |
66 | - $_day = $_month[1]; |
|
66 | + $_day = $_month[1]; |
|
67 | 67 | |
68 | - $var_temp = '0.0'; |
|
68 | + $var_temp = '0.0'; |
|
69 | 69 | |
70 | 70 | for ($i = strlen($_day); $i > 2; $i--) { |
71 | 71 | $var_temp .= '0' ; |
72 | 72 | } |
73 | 73 | |
74 | - $var_temp .= '1'; |
|
74 | + $var_temp .= '1'; |
|
75 | 75 | |
76 | - $_day = $_day * $var_temp; |
|
76 | + $_day = $_day * $var_temp; |
|
77 | 77 | |
78 | - $_day = ( $_day * 29.530 ); |
|
78 | + $_day = ( $_day * 29.530 ); |
|
79 | 79 | |
80 | - $_day = explode('.', $_day); |
|
80 | + $_day = explode('.', $_day); |
|
81 | 81 | |
82 | - $day = $_day[0]; |
|
82 | + $day = $_day[0]; |
|
83 | 83 | |
84 | 84 | $date_time->setDate($year, $month, $day); |
85 | 85 | |
86 | 86 | return $date_time; |
87 | 87 | |
88 | - }, |
|
88 | + }, |
|
89 | 89 | |
90 | 90 | /************************************************************ |
91 | 91 | * Convert From |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | 'Dhu al_Hijjah' |
194 | 194 | |
195 | - ), |
|
195 | + ), |
|
196 | 196 | |
197 | 197 | /************************************************************ |
198 | 198 | * Days of Week |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | *\_________________________________________________________/ |
205 | 205 | */ |
206 | 206 | 'days_of_week' => array ( |
207 | - 'al-Aḥad', |
|
208 | - 'al-Ithnayn', |
|
209 | - 'ath-Thulatha\'', |
|
210 | - 'al-Arbi\'a', |
|
211 | - 'al-Khamees', |
|
212 | - 'al-Jumu\'ah', |
|
213 | - 'as-Sabt', |
|
207 | + 'al-Aḥad', |
|
208 | + 'al-Ithnayn', |
|
209 | + 'ath-Thulatha\'', |
|
210 | + 'al-Arbi\'a', |
|
211 | + 'al-Khamees', |
|
212 | + 'al-Jumu\'ah', |
|
213 | + 'as-Sabt', |
|
214 | 214 | |
215 | 215 | ), |
216 | 216 | |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | |
227 | 227 | |
228 | 228 | 'month_days_number' => array( 1 => 30, |
229 | - 2 => 29, |
|
230 | - 3 => 30, |
|
231 | - 4 => 30, |
|
232 | - 5 => 29, |
|
233 | - 6 => 29, |
|
234 | - 7 => 30, |
|
235 | - 8 => 29, |
|
236 | - 9 => 30, |
|
237 | - 10 => 29, |
|
238 | - 11 => 30, |
|
239 | - 12 => 30 ), |
|
229 | + 2 => 29, |
|
230 | + 3 => 30, |
|
231 | + 4 => 30, |
|
232 | + 5 => 29, |
|
233 | + 6 => 29, |
|
234 | + 7 => 30, |
|
235 | + 8 => 29, |
|
236 | + 9 => 30, |
|
237 | + 10 => 29, |
|
238 | + 11 => 30, |
|
239 | + 12 => 30 ), |
|
240 | 240 | /************************************************************ |
241 | 241 | * Day of year |
242 | 242 | ************************************************************ |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | *\_________________________________________________________/ |
247 | 247 | */ |
248 | - 'day_of_year' => function ($date_time) { |
|
248 | + 'day_of_year' => function ($date_time) { |
|
249 | 249 | |
250 | 250 | $result = null; |
251 | 251 | |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | |
266 | 266 | return $result; |
267 | 267 | |
268 | - }, |
|
268 | + }, |
|
269 | 269 | |
270 | - /************************************************************ |
|
270 | + /************************************************************ |
|
271 | 271 | * Day of week |
272 | 272 | ************************************************************ |
273 | 273 | * |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * example : al-Aḥad = result is 1 |
276 | 276 | *\_________________________________________________________/ |
277 | 277 | */ |
278 | - 'day_of_week' => function ($date_time) { |
|
278 | + 'day_of_week' => function ($date_time) { |
|
279 | 279 | |
280 | 280 | $configGhamari = include 'Hijri.php'; |
281 | 281 | |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | - }, |
|
294 | + }, |
|
295 | 295 | |
296 | - /************************************************************ |
|
296 | + /************************************************************ |
|
297 | 297 | * Leap year |
298 | 298 | ************************************************************ |
299 | 299 | * |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * |
302 | 302 | *\_________________________________________________________/ |
303 | 303 | */ |
304 | - 'leap_year' => null, |
|
304 | + 'leap_year' => null, |
|
305 | 305 | |
306 | 306 | /************************************************************ |
307 | 307 | * Weekend |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use OpenCafe\Datium as Datium; |
4 | 4 | use OpenCafe\Tools\Leap as Leap; |
5 | 5 | |
6 | - return array ( |
|
6 | + return array( |
|
7 | 7 | |
8 | 8 | /************************************************************ |
9 | 9 | * Convert to |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | *\_________________________________________________________/ |
15 | 15 | */ |
16 | - 'convert_to' => function ($date_time) { |
|
16 | + 'convert_to' => function($date_time) { |
|
17 | 17 | |
18 | 18 | $config = include 'Jalali.php'; |
19 | 19 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | |
26 | 26 | $day = $date_time->format('d'); |
27 | 27 | |
28 | - $temp_day = 0 ; |
|
28 | + $temp_day = 0; |
|
29 | 29 | |
30 | 30 | for ($i = 1; $i < $month; $i++) { |
31 | - $temp_day += $config[ 'month_days_number' ][ $i ]; |
|
31 | + $temp_day += $config['month_days_number'][$i]; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $temp_day += $day; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $temp_day++; |
40 | 40 | } |
41 | 41 | |
42 | - $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1; |
|
42 | + $_year = ((((($year - 1) * 365.2422) + $temp_day) - 119) / 354.3670) + 1; |
|
43 | 43 | |
44 | 44 | $_year = explode('.', $_year); |
45 | 45 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | |
56 | 56 | $var_temp .= '1'; |
57 | 57 | |
58 | - $_month = $_month * $var_temp ; |
|
58 | + $_month = $_month * $var_temp; |
|
59 | 59 | |
60 | - $_month = ( $_month * 12 ) + 1; |
|
60 | + $_month = ($_month * 12) + 1; |
|
61 | 61 | |
62 | 62 | $_month = explode('.', $_month); |
63 | 63 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | $var_temp = '0.0'; |
69 | 69 | |
70 | 70 | for ($i = strlen($_day); $i > 2; $i--) { |
71 | - $var_temp .= '0' ; |
|
71 | + $var_temp .= '0'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $var_temp .= '1'; |
75 | 75 | |
76 | 76 | $_day = $_day * $var_temp; |
77 | 77 | |
78 | - $_day = ( $_day * 29.530 ); |
|
78 | + $_day = ($_day * 29.530); |
|
79 | 79 | |
80 | 80 | $_day = explode('.', $_day); |
81 | 81 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | *\_________________________________________________________/ |
97 | 97 | */ |
98 | - 'convert_from' => function ($date_time) { |
|
98 | + 'convert_from' => function($date_time) { |
|
99 | 99 | |
100 | 100 | $config = include 'Hijri.php'; |
101 | 101 | |
@@ -115,21 +115,21 @@ discard block |
||
115 | 115 | |
116 | 116 | $days_of_year += $day; |
117 | 117 | |
118 | - $days_of_leap_years = intval(( ( $year - 1 ) / 3 )); |
|
118 | + $days_of_leap_years = intval((($year - 1) / 3)); |
|
119 | 119 | |
120 | - $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
120 | + $days_of_ghamari_years = ((($year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
121 | 121 | |
122 | 122 | $days_of_gregorain_years = $days_of_ghamari_years + 227078; |
123 | 123 | |
124 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 578 ) / 4 )); |
|
124 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 578) / 4)); |
|
125 | 125 | |
126 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
126 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
127 | 127 | |
128 | 128 | $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
129 | 129 | |
130 | 130 | $config = include 'Gregorian.php'; |
131 | 131 | |
132 | - foreach ($config [ 'month_days_number' ] as $month => $value) { |
|
132 | + foreach ($config ['month_days_number'] as $month => $value) { |
|
133 | 133 | if ($gregorian_month < $value) { |
134 | 134 | break; |
135 | 135 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | *\_________________________________________________________/ |
168 | 168 | */ |
169 | - 'month' => array ( |
|
169 | + 'month' => array( |
|
170 | 170 | |
171 | 171 | 'Muharram', |
172 | 172 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * |
204 | 204 | *\_________________________________________________________/ |
205 | 205 | */ |
206 | - 'days_of_week' => array ( |
|
206 | + 'days_of_week' => array( |
|
207 | 207 | 'al-Aḥad', |
208 | 208 | 'al-Ithnayn', |
209 | 209 | 'ath-Thulatha\'', |
@@ -214,18 +214,18 @@ discard block |
||
214 | 214 | |
215 | 215 | ), |
216 | 216 | |
217 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
217 | + 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
218 | 218 | |
219 | 219 | 'am_time' => 'AM', |
220 | 220 | |
221 | 221 | 'pm_time' => 'PM', |
222 | 222 | |
223 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
223 | + 'end_of_days' => array('th', 'st', 'nd', 'rd'), |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
227 | 227 | |
228 | - 'month_days_number' => array( 1 => 30, |
|
228 | + 'month_days_number' => array(1 => 30, |
|
229 | 229 | 2 => 29, |
230 | 230 | 3 => 30, |
231 | 231 | 4 => 30, |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | 9 => 30, |
237 | 237 | 10 => 29, |
238 | 238 | 11 => 30, |
239 | - 12 => 30 ), |
|
239 | + 12 => 30), |
|
240 | 240 | /************************************************************ |
241 | 241 | * Day of year |
242 | 242 | ************************************************************ |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * |
246 | 246 | *\_________________________________________________________/ |
247 | 247 | */ |
248 | - 'day_of_year' => function ($date_time) { |
|
248 | + 'day_of_year' => function($date_time) { |
|
249 | 249 | |
250 | 250 | $result = null; |
251 | 251 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * example : al-Aḥad = result is 1 |
276 | 276 | *\_________________________________________________________/ |
277 | 277 | */ |
278 | - 'day_of_week' => function ($date_time) { |
|
278 | + 'day_of_week' => function($date_time) { |
|
279 | 279 | |
280 | 280 | $configGhamari = include 'Hijri.php'; |
281 | 281 | |
@@ -311,6 +311,6 @@ discard block |
||
311 | 311 | * |
312 | 312 | *\_________________________________________________________/ |
313 | 313 | */ |
314 | - 'weekend' => array( 'friday', 'saturday' ), |
|
314 | + 'weekend' => array('friday', 'saturday'), |
|
315 | 315 | |
316 | 316 | ); |