@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function __construct($date_time, $calendar_type = 'gregorian') |
| 29 | 29 | { |
| 30 | 30 | |
| 31 | - $this->config = include __DIR__.'/CalendarSettings/' . ucfirst($calendar_type) . '.php'; |
|
| 31 | + $this->config = include __DIR__.'/CalendarSettings/'.ucfirst($calendar_type).'.php'; |
|
| 32 | 32 | |
| 33 | 33 | $this->calendar_type = $calendar_type; |
| 34 | 34 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function year() |
| 48 | 48 | { |
| 49 | 49 | |
| 50 | - return $this->config[ 'day_of_year' ]( $this->date_time ); |
|
| 50 | + return $this->config['day_of_year']($this->date_time); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function week() |
| 62 | 62 | { |
| 63 | 63 | |
| 64 | - return $this->config[ 'day_of_week' ]( $this->date_time ); |
|
| 64 | + return $this->config['day_of_week']($this->date_time); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -75,31 +75,31 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $days = 0; |
| 77 | 77 | |
| 78 | - switch ( $this->calendar_type ) { |
|
| 78 | + switch ($this->calendar_type) { |
|
| 79 | 79 | |
| 80 | 80 | case 'gregorian': |
| 81 | 81 | |
| 82 | - if ( intval( $this->date_time->format( 'm' ) ) == 2 && |
|
| 83 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) |
|
| 84 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1; |
|
| 82 | + if (intval($this->date_time->format('m')) == 2 && |
|
| 83 | + $this->config['leap_year']($this->date_time->format('Y'))) |
|
| 84 | + $days = $this->config['month_days_number'][intval($this->date_time->format('m'))] + 1; |
|
| 85 | 85 | else |
| 86 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 86 | + $days = $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
| 87 | 87 | |
| 88 | 88 | break; |
| 89 | 89 | |
| 90 | 90 | case 'jalali': |
| 91 | 91 | |
| 92 | - if ( intval( $this->date_time->format( 'm' ) ) == 12 && |
|
| 93 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) |
|
| 94 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1; |
|
| 92 | + if (intval($this->date_time->format('m')) == 12 && |
|
| 93 | + $this->config['leap_year']($this->date_time->format('Y'))) |
|
| 94 | + $days = $this->config['month_days_number'][intval($this->date_time->format('m'))] + 1; |
|
| 95 | 95 | else |
| 96 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 96 | + $days = $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
| 97 | 97 | |
| 98 | 98 | break; |
| 99 | 99 | |
| 100 | 100 | default: |
| 101 | 101 | |
| 102 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 102 | + $days = $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
| 103 | 103 | |
| 104 | 104 | break; |
| 105 | 105 | |