@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * Get current datetime |
197 | 197 | * |
198 | 198 | * @since Aug 17 2015 |
199 | - * @return object |
|
199 | + * @return Datium |
|
200 | 200 | */ |
201 | 201 | public static function now() |
202 | 202 | { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param integer $minute minute number |
218 | 218 | * @param integer $second second number |
219 | 219 | * |
220 | - * @return object |
|
220 | + * @return Datium |
|
221 | 221 | */ |
222 | 222 | public static function create( |
223 | 223 | $year = 2000, |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * Accecpt Timestamp as Datium initializion |
258 | 258 | * |
259 | 259 | * @param timestamp $timestamp Input timestamp value |
260 | - * @return object |
|
260 | + * @return Datium |
|
261 | 261 | */ |
262 | 262 | public static function createTimestamp( $timestamp ) |
263 | 263 | { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @param object $date_start Start of the DateTime |
287 | 287 | * @param object $date_end End of the DateTime |
288 | 288 | * |
289 | - * @return object |
|
289 | + * @return Datium |
|
290 | 290 | */ |
291 | 291 | public static function between($date_start, $date_end) |
292 | 292 | { |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @param object $calendar Assigned calendar to when calendar should start. |
334 | 334 | * |
335 | - * @return object |
|
335 | + * @return Datium |
|
336 | 336 | */ |
337 | 337 | public function to($calendar) |
338 | 338 | { |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | * |
387 | 387 | * @param string $value How much date should be added to current date |
388 | 388 | * |
389 | - * @return object |
|
389 | + * @return Datium |
|
390 | 390 | */ |
391 | 391 | public function add($value) |
392 | 392 | { |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * |
429 | 429 | * @param string $value How much date should increase from current date |
430 | 430 | * |
431 | - * @return obejct |
|
431 | + * @return Datium |
|
432 | 432 | */ |
433 | 433 | public function sub($value) |
434 | 434 | { |
@@ -468,9 +468,8 @@ discard block |
||
468 | 468 | /** |
469 | 469 | * Check if current year is leap or not |
470 | 470 | * |
471 | - * @param string $type Name of the calendar to caculate leap year |
|
472 | 471 | * |
473 | - * @return boolean |
|
472 | + * @return Leap |
|
474 | 473 | */ |
475 | 474 | public function leap() |
476 | 475 | { |
@@ -484,7 +483,7 @@ discard block |
||
484 | 483 | /** |
485 | 484 | * Calculate how many time ago datetime happens |
486 | 485 | * |
487 | - * @return string |
|
486 | + * @return TimeAgo |
|
488 | 487 | */ |
489 | 488 | public function ago() |
490 | 489 | { |
@@ -500,7 +499,7 @@ discard block |
||
500 | 499 | * |
501 | 500 | * @since Aug, 22 2015 |
502 | 501 | * |
503 | - * @return integer |
|
502 | + * @return DayOf |
|
504 | 503 | */ |
505 | 504 | public function dayOf() |
506 | 505 | { |
@@ -533,7 +532,7 @@ discard block |
||
533 | 532 | * |
534 | 533 | * @since Oct 22, 2015 |
535 | 534 | * |
536 | - * @return object |
|
535 | + * @return DateTime |
|
537 | 536 | */ |
538 | 537 | public function object() |
539 | 538 | { |
@@ -547,7 +546,7 @@ discard block |
||
547 | 546 | * |
548 | 547 | * @param string $language language short name fa, en, ar ... |
549 | 548 | * |
550 | - * @return object |
|
549 | + * @return Datium |
|
551 | 550 | */ |
552 | 551 | public function lang($language = 'fa') |
553 | 552 | { |
@@ -567,7 +566,7 @@ discard block |
||
567 | 566 | /** |
568 | 567 | * Return object as timestamp |
569 | 568 | * |
570 | - * @return timestamp |
|
569 | + * @return integer |
|
571 | 570 | */ |
572 | 571 | public function timestamp() |
573 | 572 | { |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->config = include 'Config.php'; |
115 | 115 | |
116 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
116 | + $this->calendar_type = $this->config['default_calendar']; |
|
117 | 117 | |
118 | - date_default_timezone_set($this->config[ 'timezone' ]); |
|
118 | + date_default_timezone_set($this->config['timezone']); |
|
119 | 119 | |
120 | 120 | $this->calendar_type = 'gregorian'; |
121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $this->date_time = new DateTime(); |
128 | 128 | |
129 | - $this->date_time->setTimestamp( self::$timestamp ); |
|
129 | + $this->date_time->setTimestamp(self::$timestamp); |
|
130 | 130 | |
131 | 131 | break; |
132 | 132 | |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | $this->date_time = new DateTime('now'); |
142 | 142 | |
143 | 143 | $this->date_time->setDate( |
144 | - self::$array_date[ 'year' ], |
|
145 | - self::$array_date[ 'month' ], |
|
146 | - self::$array_date[ 'day' ] |
|
144 | + self::$array_date['year'], |
|
145 | + self::$array_date['month'], |
|
146 | + self::$array_date['day'] |
|
147 | 147 | ); |
148 | 148 | |
149 | 149 | $this->date_time->setTime( |
150 | - self::$array_date[ 'hour' ], |
|
151 | - self::$array_date[ 'minute' ], |
|
152 | - self::$array_date[ 'second' ] |
|
150 | + self::$array_date['hour'], |
|
151 | + self::$array_date['minute'], |
|
152 | + self::$array_date['second'] |
|
153 | 153 | ); |
154 | 154 | |
155 | 155 | break; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function all() |
175 | 175 | { |
176 | 176 | |
177 | - return ( object ) array( |
|
177 | + return (object) array( |
|
178 | 178 | |
179 | 179 | 'second' => $this->date_time->format('s'), |
180 | 180 | |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | * @param timestamp $timestamp Input timestamp value |
260 | 260 | * @return object |
261 | 261 | */ |
262 | - public static function createTimestamp( $timestamp ) |
|
262 | + public static function createTimestamp($timestamp) |
|
263 | 263 | { |
264 | 264 | |
265 | - if( $timestamp != null && is_int( $timestamp ) ) |
|
265 | + if ($timestamp != null && is_int($timestamp)) |
|
266 | 266 | { |
267 | 267 | |
268 | 268 | self::$call_type = 'create-timestamp'; |
@@ -392,15 +392,15 @@ discard block |
||
392 | 392 | { |
393 | 393 | |
394 | 394 | $this->date_interval_expression = str_replace( |
395 | - $this->config[ 'date_simple' ], |
|
396 | - $this->config[ 'date_interval' ], |
|
395 | + $this->config['date_simple'], |
|
396 | + $this->config['date_interval'], |
|
397 | 397 | $value |
398 | 398 | ); |
399 | 399 | |
400 | 400 | $unit = 'P'; |
401 | 401 | |
402 | 402 | if (strpos($this->date_interval_expression, 'T')) { |
403 | - $this->date_interval_expression= str_replace( |
|
403 | + $this->date_interval_expression = str_replace( |
|
404 | 404 | 'T', |
405 | 405 | '', |
406 | 406 | $this->date_interval_expression |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $this->date_interval_expression = str_replace( |
413 | 413 | ' ', |
414 | 414 | '', |
415 | - $unit . $this->date_interval_expression |
|
415 | + $unit.$this->date_interval_expression |
|
416 | 416 | ); |
417 | 417 | |
418 | 418 | $this->date_time->add( |
@@ -434,15 +434,15 @@ discard block |
||
434 | 434 | { |
435 | 435 | |
436 | 436 | $this->date_interval_expression = str_replace( |
437 | - $this->config[ 'date_simple' ], |
|
438 | - $this->config[ 'date_interval' ], |
|
437 | + $this->config['date_simple'], |
|
438 | + $this->config['date_interval'], |
|
439 | 439 | $value |
440 | 440 | ); |
441 | 441 | |
442 | 442 | $unit = 'P'; |
443 | 443 | |
444 | 444 | if (strpos($this->date_interval_expression, 'T')) { |
445 | - $this->date_interval_expression= str_replace( |
|
445 | + $this->date_interval_expression = str_replace( |
|
446 | 446 | 'T', |
447 | 447 | '', |
448 | 448 | $this->date_interval_expression |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $this->date_interval_expression = str_replace( |
455 | 455 | ' ', |
456 | 456 | '', |
457 | - $unit . $this->date_interval_expression |
|
457 | + $unit.$this->date_interval_expression |
|
458 | 458 | ); |
459 | 459 | |
460 | 460 | $this->date_time->sub( |
@@ -593,52 +593,52 @@ discard block |
||
593 | 593 | // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
594 | 594 | |
595 | 595 | if (is_null($this->fromConfig)) { |
596 | - $this->fromConfig = include 'CalendarSettings/' . |
|
597 | - ucfirst($this->translate_from) . '.php'; |
|
596 | + $this->fromConfig = include 'CalendarSettings/'. |
|
597 | + ucfirst($this->translate_from).'.php'; |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | |
601 | 601 | if (is_null($this->toConfig)) { |
602 | - $this->toConfig = include 'CalendarSettings/' . |
|
603 | - ucfirst($this->translate_to) . '.php'; |
|
602 | + $this->toConfig = include 'CalendarSettings/'. |
|
603 | + ucfirst($this->translate_to).'.php'; |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | $string_date = $this->date_time->format($format); |
607 | 607 | |
608 | 608 | if ($this->translate_to != 'gregorian') { |
609 | 609 | $string_date = str_replace( |
610 | - $this->fromConfig[ 'month' ], |
|
611 | - $this->toConfig[ 'month' ], |
|
610 | + $this->fromConfig['month'], |
|
611 | + $this->toConfig['month'], |
|
612 | 612 | $string_date |
613 | 613 | ); |
614 | 614 | |
615 | 615 | $string_date = str_replace( |
616 | - $this->fromConfig[ 'days_of_week' ], |
|
617 | - $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ], |
|
616 | + $this->fromConfig['days_of_week'], |
|
617 | + $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], |
|
618 | 618 | $string_date |
619 | 619 | ); |
620 | 620 | |
621 | 621 | $string_date = str_replace( |
622 | - $this->fromConfig[ 'numbers' ], |
|
623 | - $this->toConfig[ 'numbers' ], |
|
622 | + $this->fromConfig['numbers'], |
|
623 | + $this->toConfig['numbers'], |
|
624 | 624 | $string_date |
625 | 625 | ); |
626 | 626 | |
627 | 627 | $string_date = str_replace( |
628 | - $this->fromConfig[ 'am_time' ], |
|
629 | - $this->toConfig[ 'am_time' ], |
|
628 | + $this->fromConfig['am_time'], |
|
629 | + $this->toConfig['am_time'], |
|
630 | 630 | $string_date |
631 | 631 | ); |
632 | 632 | |
633 | 633 | $string_date = str_replace( |
634 | - $this->fromConfig[ 'pm_time' ], |
|
635 | - $this->toConfig[ 'pm_time' ], |
|
634 | + $this->fromConfig['pm_time'], |
|
635 | + $this->toConfig['pm_time'], |
|
636 | 636 | $string_date |
637 | 637 | ); |
638 | 638 | |
639 | 639 | $string_date = str_replace( |
640 | - $this->fromConfig[ 'end_of_days' ], |
|
641 | - $this->toConfig[ 'end_of_days' ], |
|
640 | + $this->fromConfig['end_of_days'], |
|
641 | + $this->toConfig['end_of_days'], |
|
642 | 642 | $string_date |
643 | 643 | ); |
644 | 644 | } |