@@ -2,9 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array(), |
|
| 5 | + 'events' => array(), |
|
| 6 | 6 | |
| 7 | - 'month' => array( |
|
| 7 | + 'month' => array( |
|
| 8 | 8 | 'خاکەلێوە', |
| 9 | 9 | 'گوڵان', |
| 10 | 10 | 'زجۆزەردان', |
@@ -37,5 +37,5 @@ |
||
| 37 | 37 | |
| 38 | 38 | 'end_of_days' => array(), |
| 39 | 39 | |
| 40 | - 'numbers' => array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' ), |
|
| 40 | + 'numbers' => array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'), |
|
| 41 | 41 | ); |
@@ -7,35 +7,35 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | class DayOf |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * @var object |
|
| 12 | - */ |
|
| 10 | + /** |
|
| 11 | + * @var object |
|
| 12 | + */ |
|
| 13 | 13 | protected $date_time; |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @var array |
|
| 17 | - */ |
|
| 15 | + /** |
|
| 16 | + * @var array |
|
| 17 | + */ |
|
| 18 | 18 | protected $config; |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - protected $calendar_type; |
|
| 20 | + /** |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + protected $calendar_type; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @var int |
| 27 | 27 | */ |
| 28 | 28 | protected $day_of_week; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Constructor of DayOf class |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * Constructor of DayOf class |
|
| 32 | + */ |
|
| 33 | 33 | public function __construct($date_time, $calendar_type = 'gregorian', $day_of_week = null) |
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - $this->config = include __DIR__.'/CalendarSettings/' . ucfirst($calendar_type) . '.php'; |
|
| 36 | + $this->config = include __DIR__.'/CalendarSettings/' . ucfirst($calendar_type) . '.php'; |
|
| 37 | 37 | |
| 38 | - $this->calendar_type = $calendar_type; |
|
| 38 | + $this->calendar_type = $calendar_type; |
|
| 39 | 39 | |
| 40 | 40 | $this->date_time = $date_time; |
| 41 | 41 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Which day of year is current day. |
|
| 50 | - * |
|
| 51 | - * @since Aug, 03 2015 |
|
| 52 | - * @return integer |
|
| 53 | - */ |
|
| 49 | + * Which day of year is current day. |
|
| 50 | + * |
|
| 51 | + * @since Aug, 03 2015 |
|
| 52 | + * @return integer |
|
| 53 | + */ |
|
| 54 | 54 | public function year() |
| 55 | 55 | { |
| 56 | 56 | |
@@ -60,56 +60,56 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Which day of week is current day. |
|
| 64 | - * |
|
| 65 | - * @since Aug, 09 2015 |
|
| 66 | - * @return integer |
|
| 67 | - */ |
|
| 63 | + * Which day of week is current day. |
|
| 64 | + * |
|
| 65 | + * @since Aug, 09 2015 |
|
| 66 | + * @return integer |
|
| 67 | + */ |
|
| 68 | 68 | public function week() |
| 69 | 69 | { |
| 70 | 70 | return $this->config[ 'day_of_week' ]( $this->date_time, $this->day_of_week ); |
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Return last day of current month |
|
| 76 | - * |
|
| 77 | - * @since Oct, 18 2016 |
|
| 78 | - * @return integer |
|
| 79 | - */ |
|
| 80 | - public function lastDayMonth() { |
|
| 74 | + /** |
|
| 75 | + * Return last day of current month |
|
| 76 | + * |
|
| 77 | + * @since Oct, 18 2016 |
|
| 78 | + * @return integer |
|
| 79 | + */ |
|
| 80 | + public function lastDayMonth() { |
|
| 81 | 81 | |
| 82 | - $days = 0; |
|
| 82 | + $days = 0; |
|
| 83 | 83 | |
| 84 | - switch ( $this->calendar_type ) { |
|
| 84 | + switch ( $this->calendar_type ) { |
|
| 85 | 85 | |
| 86 | - case 'gregorian': |
|
| 86 | + case 'gregorian': |
|
| 87 | 87 | |
| 88 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 2 && |
|
| 89 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
| 90 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
| 91 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 88 | + $days = ( intval( $this->date_time->format( 'm' ) ) == 2 && |
|
| 89 | + $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
| 90 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
| 91 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 92 | 92 | |
| 93 | - break; |
|
| 93 | + break; |
|
| 94 | 94 | |
| 95 | - case 'jalali': |
|
| 95 | + case 'jalali': |
|
| 96 | 96 | |
| 97 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 12 && |
|
| 98 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
| 99 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
| 100 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 97 | + $days = ( intval( $this->date_time->format( 'm' ) ) == 12 && |
|
| 98 | + $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
| 99 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
| 100 | + $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 101 | 101 | |
| 102 | - break; |
|
| 102 | + break; |
|
| 103 | 103 | |
| 104 | - default: |
|
| 104 | + default: |
|
| 105 | 105 | |
| 106 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 106 | + $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 107 | 107 | |
| 108 | - break; |
|
| 108 | + break; |
|
| 109 | 109 | |
| 110 | - } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - return $days; |
|
| 112 | + return $days; |
|
| 113 | 113 | |
| 114 | - } |
|
| 114 | + } |
|
| 115 | 115 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function __construct($date_time, $calendar_type = 'gregorian', $day_of_week = null) |
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - $this->config = include __DIR__.'/CalendarSettings/' . ucfirst($calendar_type) . '.php'; |
|
| 36 | + $this->config = include __DIR__.'/CalendarSettings/'.ucfirst($calendar_type).'.php'; |
|
| 37 | 37 | |
| 38 | 38 | $this->calendar_type = $calendar_type; |
| 39 | 39 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function year() |
| 55 | 55 | { |
| 56 | 56 | |
| 57 | - return $this->config[ 'day_of_year' ]( $this->date_time ); |
|
| 57 | + return $this->config['day_of_year']($this->date_time); |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function week() |
| 69 | 69 | { |
| 70 | - return $this->config[ 'day_of_week' ]( $this->date_time, $this->day_of_week ); |
|
| 70 | + return $this->config['day_of_week']($this->date_time, $this->day_of_week); |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
@@ -81,29 +81,27 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $days = 0; |
| 83 | 83 | |
| 84 | - switch ( $this->calendar_type ) { |
|
| 84 | + switch ($this->calendar_type) { |
|
| 85 | 85 | |
| 86 | 86 | case 'gregorian': |
| 87 | 87 | |
| 88 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 2 && |
|
| 89 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
| 90 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
| 91 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 88 | + $days = (intval($this->date_time->format('m')) == 2 && |
|
| 89 | + $this->config['leap_year']($this->date_time->format('Y'))) ? |
|
| 90 | + $this->config['month_days_number'][intval($this->date_time->format('m'))] + 1 : $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
| 92 | 91 | |
| 93 | 92 | break; |
| 94 | 93 | |
| 95 | 94 | case 'jalali': |
| 96 | 95 | |
| 97 | - $days = ( intval( $this->date_time->format( 'm' ) ) == 12 && |
|
| 98 | - $this->config[ 'leap_year' ]( $this->date_time->format( 'Y' )) ) ? |
|
| 99 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ] + 1 : |
|
| 100 | - $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 96 | + $days = (intval($this->date_time->format('m')) == 12 && |
|
| 97 | + $this->config['leap_year']($this->date_time->format('Y'))) ? |
|
| 98 | + $this->config['month_days_number'][intval($this->date_time->format('m'))] + 1 : $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
| 101 | 99 | |
| 102 | 100 | break; |
| 103 | 101 | |
| 104 | 102 | default: |
| 105 | 103 | |
| 106 | - $days = $this->config[ 'month_days_number' ][ intval( $this->date_time->format( 'm' ) ) ]; |
|
| 104 | + $days = $this->config['month_days_number'][intval($this->date_time->format('m'))]; |
|
| 107 | 105 | |
| 108 | 106 | break; |
| 109 | 107 | |
@@ -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 | } |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $gregorian_month = $month; |
| 167 | 167 | |
| 168 | - if ( ( ( $gregorian_year % 4 ) == 0 ) && ( ( ( $gregorian_year % 100 ) != 0 ) || ( ( $gregorian_year % 400 ) == 0 ) ) ) { |
|
| 168 | + if ((($gregorian_year % 4) == 0) && ((($gregorian_year % 100) != 0) || (($gregorian_year % 400) == 0))) { |
|
| 169 | 169 | |
| 170 | - if ( $gregorian_month < 3 || ( $gregorian_month == 3 && $gregorian_day < 22 ) ) { |
|
| 170 | + if ($gregorian_month < 3 || ($gregorian_month == 3 && $gregorian_day < 22)) { |
|
| 171 | 171 | |
| 172 | 172 | $gregorian_day++; |
| 173 | 173 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | *\_________________________________________________________/ |
| 202 | 202 | */ |
| 203 | - 'month' => array ( |
|
| 203 | + 'month' => array( |
|
| 204 | 204 | |
| 205 | 205 | 'Farvardin', |
| 206 | 206 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | |
| 241 | 241 | |
| 242 | - 'days_of_week' => array ( |
|
| 242 | + 'days_of_week' => array( |
|
| 243 | 243 | |
| 244 | 244 | 'Yekshanbe', |
| 245 | 245 | 'Doshanbe', |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | 'start_day_of_week' => 'Shanbe', |
| 255 | 255 | |
| 256 | - 'month_days_number' => array( 1 => 31, |
|
| 256 | + 'month_days_number' => array(1 => 31, |
|
| 257 | 257 | 2 => 31, |
| 258 | 258 | 3 => 31, |
| 259 | 259 | 4 => 31, |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | 9 => 30, |
| 265 | 265 | 10 => 30, |
| 266 | 266 | 11 => 30, |
| 267 | - 12 => 29 ), |
|
| 267 | + 12 => 29), |
|
| 268 | 268 | |
| 269 | 269 | /************************************************************ |
| 270 | 270 | * Day of year |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | *\_________________________________________________________/ |
| 276 | 276 | */ |
| 277 | - 'day_of_year' => function ($date_time) { |
|
| 277 | + 'day_of_year' => function($date_time) { |
|
| 278 | 278 | |
| 279 | 279 | $result = null; |
| 280 | 280 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $day = $date_time->format('d'); |
| 286 | 286 | |
| 287 | - foreach ($config[ 'month_days_number' ] as $_month => $value) { |
|
| 287 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
| 288 | 288 | if ($_month < $month) { |
| 289 | 289 | $result += $value; |
| 290 | 290 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * example : Yekshanbe = result is 2 |
| 305 | 305 | *\_________________________________________________________/ |
| 306 | 306 | */ |
| 307 | - 'day_of_week' => function ($date_timem, $day_of_week) { |
|
| 307 | + 'day_of_week' => function($date_timem, $day_of_week) { |
|
| 308 | 308 | |
| 309 | 309 | $days_of_week = array( |
| 310 | 310 | 'Doshanbe', |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $configGregorian = include 'Gregorian.php'; |
| 329 | 329 | |
| 330 | 330 | $day = str_replace( |
| 331 | - $configGregorian[ 'days_of_week' ], |
|
| 331 | + $configGregorian['days_of_week'], |
|
| 332 | 332 | $days_of_week, |
| 333 | 333 | $day_of_week |
| 334 | 334 | ); |
@@ -349,26 +349,26 @@ discard block |
||
| 349 | 349 | * |
| 350 | 350 | *\_________________________________________________________/ |
| 351 | 351 | */ |
| 352 | - 'leap_year' => function ($year) { |
|
| 352 | + 'leap_year' => function($year) { |
|
| 353 | 353 | |
| 354 | 354 | $a = 0.025; |
| 355 | 355 | |
| 356 | 356 | $b = 266; |
| 357 | 357 | |
| 358 | 358 | if ($year > 0) { |
| 359 | - $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; |
|
| 359 | + $leapDays0 = (($year + 38) % 2820) * 0.24219 + $a; |
|
| 360 | 360 | // 0.24219 ~ extra days of one year |
| 361 | - $leapDays1 = (($year + 39) % 2820)*0.24219 + $a; |
|
| 361 | + $leapDays1 = (($year + 39) % 2820) * 0.24219 + $a; |
|
| 362 | 362 | // 38 days is the difference of epoch to 2820-year cycle |
| 363 | 363 | } elseif ($year < 0) { |
| 364 | - $leapDays0 = (($year + 39) % 2820)*0.24219 + $a; |
|
| 365 | - $leapDays1 = (($year + 40) % 2820)*0.24219 + $a; |
|
| 364 | + $leapDays0 = (($year + 39) % 2820) * 0.24219 + $a; |
|
| 365 | + $leapDays1 = (($year + 40) % 2820) * 0.24219 + $a; |
|
| 366 | 366 | } else { |
| 367 | 367 | return false; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
| 371 | - $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
| 370 | + $frac0 = intval(($leapDays0 - intval($leapDays0)) * 1000); |
|
| 371 | + $frac1 = intval(($leapDays1 - intval($leapDays1)) * 1000); |
|
| 372 | 372 | |
| 373 | 373 | if ($frac0 <= $b && $frac1 > $b) { |
| 374 | 374 | return true; |
@@ -386,6 +386,6 @@ discard block |
||
| 386 | 386 | * |
| 387 | 387 | *\_________________________________________________________/ |
| 388 | 388 | */ |
| 389 | - 'weekend' => array( 'friday' ) |
|
| 389 | + 'weekend' => array('friday') |
|
| 390 | 390 | |
| 391 | 391 | ); |
@@ -118,30 +118,30 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | 'days_of_week' => array ( |
| 120 | 120 | |
| 121 | - 'Yekşeme', |
|
| 122 | - 'Dúşeme', |
|
| 123 | - 'Séşeme', |
|
| 124 | - 'Çúwarşeme', |
|
| 125 | - 'Péncşeme', |
|
| 126 | - 'Heyní', |
|
| 127 | - 'Şeme', |
|
| 121 | + 'Yekşeme', |
|
| 122 | + 'Dúşeme', |
|
| 123 | + 'Séşeme', |
|
| 124 | + 'Çúwarşeme', |
|
| 125 | + 'Péncşeme', |
|
| 126 | + 'Heyní', |
|
| 127 | + 'Şeme', |
|
| 128 | 128 | |
| 129 | 129 | ), |
| 130 | 130 | |
| 131 | 131 | 'start_day_of_week' => 'Şeme', |
| 132 | 132 | |
| 133 | 133 | 'month_days_number' => array( 1 => 31, |
| 134 | - 2 => 31, |
|
| 135 | - 3 => 31, |
|
| 136 | - 4 => 31, |
|
| 137 | - 5 => 31, |
|
| 138 | - 6 => 31, |
|
| 139 | - 7 => 30, |
|
| 140 | - 8 => 30, |
|
| 141 | - 9 => 30, |
|
| 142 | - 10 => 30, |
|
| 143 | - 11 => 30, |
|
| 144 | - 12 => 29 ), |
|
| 134 | + 2 => 31, |
|
| 135 | + 3 => 31, |
|
| 136 | + 4 => 31, |
|
| 137 | + 5 => 31, |
|
| 138 | + 6 => 31, |
|
| 139 | + 7 => 30, |
|
| 140 | + 8 => 30, |
|
| 141 | + 9 => 30, |
|
| 142 | + 10 => 30, |
|
| 143 | + 11 => 30, |
|
| 144 | + 12 => 29 ), |
|
| 145 | 145 | |
| 146 | 146 | /************************************************************ |
| 147 | 147 | * Day of year |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | foreach ($days as $key => $value) { |
| 215 | 215 | if ($day == $value) { |
| 216 | - return $key; |
|
| 216 | + return $key; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | 'leap_year' => function ($year) { |
| 231 | 231 | |
| 232 | - $a = 0.025; |
|
| 232 | + $a = 0.025; |
|
| 233 | 233 | |
| 234 | - $b = 266; |
|
| 234 | + $b = 266; |
|
| 235 | 235 | |
| 236 | 236 | if ($year > 0) { |
| 237 | 237 | $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | return false; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
| 249 | - $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
| 248 | + $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
| 249 | + $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
| 250 | 250 | |
| 251 | 251 | if ($frac0 <= $b && $frac1 > $b) { |
| 252 | 252 | return true; |
@@ -266,4 +266,4 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | 'weekend' => array( 'friday' ) |
| 268 | 268 | |
| 269 | - ); |
|
| 269 | + ); |
|
@@ -3,19 +3,19 @@ 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 | 'language' => 'ku', |
| 9 | 9 | |
| 10 | 10 | 'events' => array(), |
| 11 | 11 | |
| 12 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 12 | + 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 13 | 13 | |
| 14 | 14 | 'am_time' => 'AM', |
| 15 | 15 | |
| 16 | 16 | 'pm_time' => 'PM', |
| 17 | 17 | |
| 18 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 18 | + 'end_of_days' => array('th', 'st', 'nd', 'rd'), |
|
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | *\_________________________________________________________/ |
| 29 | 29 | */ |
| 30 | - 'convert_to' => function ($date_time) { |
|
| 30 | + 'convert_to' => function($date_time) { |
|
| 31 | 31 | |
| 32 | 32 | $jalali = include 'Jalali.php'; |
| 33 | 33 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | *\_________________________________________________________/ |
| 48 | 48 | */ |
| 49 | - 'convert_from' => function ($date_time) { |
|
| 49 | + 'convert_from' => function($date_time) { |
|
| 50 | 50 | |
| 51 | 51 | $jalali = include 'Jalali.php'; |
| 52 | 52 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | *\_________________________________________________________/ |
| 79 | 79 | */ |
| 80 | - 'month' => array ( |
|
| 80 | + 'month' => array( |
|
| 81 | 81 | |
| 82 | 82 | 'Xakelêw', |
| 83 | 83 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | |
| 118 | 118 | |
| 119 | - 'days_of_week' => array ( |
|
| 119 | + 'days_of_week' => array( |
|
| 120 | 120 | |
| 121 | 121 | 'Yekşeme', |
| 122 | 122 | 'Dúşeme', |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | 'start_day_of_week' => 'Şeme', |
| 132 | 132 | |
| 133 | - 'month_days_number' => array( 1 => 31, |
|
| 133 | + 'month_days_number' => array(1 => 31, |
|
| 134 | 134 | 2 => 31, |
| 135 | 135 | 3 => 31, |
| 136 | 136 | 4 => 31, |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | 9 => 30, |
| 142 | 142 | 10 => 30, |
| 143 | 143 | 11 => 30, |
| 144 | - 12 => 29 ), |
|
| 144 | + 12 => 29), |
|
| 145 | 145 | |
| 146 | 146 | /************************************************************ |
| 147 | 147 | * Day of year |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | *\_________________________________________________________/ |
| 153 | 153 | */ |
| 154 | - 'day_of_year' => function ($date_time) { |
|
| 154 | + 'day_of_year' => function($date_time) { |
|
| 155 | 155 | |
| 156 | 156 | $result = null; |
| 157 | 157 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $day = $date_time->format('d'); |
| 163 | 163 | |
| 164 | - foreach ($config[ 'month_days_number' ] as $_month => $value) { |
|
| 164 | + foreach ($config['month_days_number'] as $_month => $value) { |
|
| 165 | 165 | if ($_month < $month) { |
| 166 | 166 | $result += $value; |
| 167 | 167 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * example : Yekshanbe = result is 2 |
| 182 | 182 | *\_________________________________________________________/ |
| 183 | 183 | */ |
| 184 | - 'day_of_week' => function ($date_tim, $day_of_week) { |
|
| 184 | + 'day_of_week' => function($date_tim, $day_of_week) { |
|
| 185 | 185 | |
| 186 | 186 | $days_of_week = array( |
| 187 | 187 | 'Dúşeme', |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $configGregorian = include 'Gregorian.php'; |
| 207 | 207 | |
| 208 | 208 | $day = str_replace( |
| 209 | - $configGregorian[ 'days_of_week' ], |
|
| 209 | + $configGregorian['days_of_week'], |
|
| 210 | 210 | $days_of_week, |
| 211 | 211 | $day_of_week |
| 212 | 212 | ); |
@@ -227,26 +227,26 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | *\_________________________________________________________/ |
| 229 | 229 | */ |
| 230 | - 'leap_year' => function ($year) { |
|
| 230 | + 'leap_year' => function($year) { |
|
| 231 | 231 | |
| 232 | 232 | $a = 0.025; |
| 233 | 233 | |
| 234 | 234 | $b = 266; |
| 235 | 235 | |
| 236 | 236 | if ($year > 0) { |
| 237 | - $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; |
|
| 237 | + $leapDays0 = (($year + 38) % 2820) * 0.24219 + $a; |
|
| 238 | 238 | // 0.24219 ~ extra days of one year |
| 239 | - $leapDays1 = (($year + 39) % 2820)*0.24219 + $a; |
|
| 239 | + $leapDays1 = (($year + 39) % 2820) * 0.24219 + $a; |
|
| 240 | 240 | // 38 days is the difference of epoch to 2820-year cycle |
| 241 | 241 | } elseif ($year < 0) { |
| 242 | - $leapDays0 = (($year + 39) % 2820)*0.24219 + $a; |
|
| 243 | - $leapDays1 = (($year + 40) % 2820)*0.24219 + $a; |
|
| 242 | + $leapDays0 = (($year + 39) % 2820) * 0.24219 + $a; |
|
| 243 | + $leapDays1 = (($year + 40) % 2820) * 0.24219 + $a; |
|
| 244 | 244 | } else { |
| 245 | 245 | return false; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
| 249 | - $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
| 248 | + $frac0 = intval(($leapDays0 - intval($leapDays0)) * 1000); |
|
| 249 | + $frac1 = intval(($leapDays1 - intval($leapDays1)) * 1000); |
|
| 250 | 250 | |
| 251 | 251 | if ($frac0 <= $b && $frac1 > $b) { |
| 252 | 252 | return true; |
@@ -264,6 +264,6 @@ discard block |
||
| 264 | 264 | * |
| 265 | 265 | *\_________________________________________________________/ |
| 266 | 266 | */ |
| 267 | - 'weekend' => array( 'friday' ) |
|
| 267 | + 'weekend' => array('friday') |
|
| 268 | 268 | |
| 269 | 269 | ); |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 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 |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | 'Dhu al_Hijjah' |
| 167 | 167 | |
| 168 | - ), |
|
| 168 | + ), |
|
| 169 | 169 | |
| 170 | 170 | /************************************************************ |
| 171 | 171 | * Days of Week |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | 'days_of_week' => array ( |
| 180 | 180 | |
| 181 | - 'al-Aḥad', |
|
| 182 | - 'al-Ithnayn', |
|
| 183 | - 'ath-Thulatha\'', |
|
| 184 | - 'al-Arbi\'a', |
|
| 185 | - 'al-Khamees', |
|
| 186 | - 'al-Jumu\'ah', |
|
| 187 | - 'as-Sabt', |
|
| 181 | + 'al-Aḥad', |
|
| 182 | + 'al-Ithnayn', |
|
| 183 | + 'ath-Thulatha\'', |
|
| 184 | + 'al-Arbi\'a', |
|
| 185 | + 'al-Khamees', |
|
| 186 | + 'al-Jumu\'ah', |
|
| 187 | + 'as-Sabt', |
|
| 188 | 188 | ), |
| 189 | 189 | |
| 190 | 190 | 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | 'month_days_number' => array( 1 => 30, |
| 202 | - 2 => 29, |
|
| 203 | - 3 => 30, |
|
| 204 | - 4 => 30, |
|
| 205 | - 5 => 29, |
|
| 206 | - 6 => 29, |
|
| 207 | - 7 => 30, |
|
| 208 | - 8 => 29, |
|
| 209 | - 9 => 30, |
|
| 210 | - 10 => 29, |
|
| 211 | - 11 => 30, |
|
| 212 | - 12 => 30 ), |
|
| 202 | + 2 => 29, |
|
| 203 | + 3 => 30, |
|
| 204 | + 4 => 30, |
|
| 205 | + 5 => 29, |
|
| 206 | + 6 => 29, |
|
| 207 | + 7 => 30, |
|
| 208 | + 8 => 29, |
|
| 209 | + 9 => 30, |
|
| 210 | + 10 => 29, |
|
| 211 | + 11 => 30, |
|
| 212 | + 12 => 30 ), |
|
| 213 | 213 | /************************************************************ |
| 214 | 214 | * Day of year |
| 215 | 215 | ************************************************************ |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | *\_________________________________________________________/ |
| 220 | 220 | */ |
| 221 | - 'day_of_year' => function ($date_time) { |
|
| 221 | + 'day_of_year' => function ($date_time) { |
|
| 222 | 222 | |
| 223 | 223 | $result = null; |
| 224 | 224 | |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | return $result; |
| 240 | 240 | |
| 241 | - }, |
|
| 241 | + }, |
|
| 242 | 242 | |
| 243 | - /************************************************************ |
|
| 243 | + /************************************************************ |
|
| 244 | 244 | * Day of week |
| 245 | 245 | ************************************************************ |
| 246 | 246 | * |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | * example : al-Aḥad = result is 1 |
| 249 | 249 | *\_________________________________________________________/ |
| 250 | 250 | */ |
| 251 | - 'day_of_week' => function ($date_time, $day_of_week) { |
|
| 251 | + 'day_of_week' => function ($date_time, $day_of_week) { |
|
| 252 | 252 | |
| 253 | - $days_of_week = array( |
|
| 253 | + $days_of_week = array( |
|
| 254 | 254 | 'al-Ithnayn', |
| 255 | 255 | 'ath-Thulatha\'', |
| 256 | 256 | 'al-Arbi\'a', |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | 'al-Jumu\'ah', |
| 259 | 259 | 'as-Sabt', |
| 260 | 260 | 'al-Aḥad', |
| 261 | - ); |
|
| 261 | + ); |
|
| 262 | 262 | |
| 263 | - $days = array( |
|
| 263 | + $days = array( |
|
| 264 | 264 | 1 => 'al-Aḥad', |
| 265 | 265 | 2 => 'al-Ithnayn', |
| 266 | 266 | 3 => 'ath-Thulatha\'', |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | 5 => 'al-Khamees', |
| 269 | 269 | 6 => 'al-Jumu\'ah', |
| 270 | 270 | 7 => 'as-Sabt', |
| 271 | - ); |
|
| 271 | + ); |
|
| 272 | 272 | |
| 273 | 273 | $configGregorian = include 'Gregorian.php'; |
| 274 | 274 | |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - }, |
|
| 283 | + }, |
|
| 284 | 284 | |
| 285 | - /************************************************************ |
|
| 285 | + /************************************************************ |
|
| 286 | 286 | * Leap year |
| 287 | 287 | ************************************************************ |
| 288 | 288 | * |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | *\_________________________________________________________/ |
| 292 | 292 | */ |
| 293 | - 'leap_year' => function ($year) { |
|
| 293 | + 'leap_year' => function ($year) { |
|
| 294 | 294 | $result = $this->year % 30; |
| 295 | 295 | |
| 296 | 296 | if (( 2 == $result ) |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | ) { |
| 308 | 308 | return $result; |
| 309 | 309 | } |
| 310 | - }, |
|
| 310 | + }, |
|
| 311 | 311 | |
| 312 | 312 | /************************************************************ |
| 313 | 313 | * 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 | $year = $date_time->format('Y'); |
| 101 | 101 | |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $day = $date_time->format('d'); |
| 105 | 105 | |
| 106 | - $jd = (int)((11 * $year + 3) / 30) + 354 * $year + |
|
| 107 | - 30 * $month -(int)(($month - 1) / 2) + $day + 1948440 - 385; |
|
| 106 | + $jd = (int) ((11 * $year + 3) / 30) + 354 * $year + |
|
| 107 | + 30 * $month - (int) (($month - 1) / 2) + $day + 1948440 - 385; |
|
| 108 | 108 | |
| 109 | 109 | $result = explode('/', jdtogregorian($jd)); |
| 110 | 110 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | *\_________________________________________________________/ |
| 141 | 141 | */ |
| 142 | - 'month' => array ( |
|
| 142 | + 'month' => array( |
|
| 143 | 143 | |
| 144 | 144 | 'Muharram', |
| 145 | 145 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * |
| 177 | 177 | *\_________________________________________________________/ |
| 178 | 178 | */ |
| 179 | - 'days_of_week' => array ( |
|
| 179 | + 'days_of_week' => array( |
|
| 180 | 180 | |
| 181 | 181 | 'al-Aḥad', |
| 182 | 182 | 'al-Ithnayn', |
@@ -187,18 +187,18 @@ discard block |
||
| 187 | 187 | 'as-Sabt', |
| 188 | 188 | ), |
| 189 | 189 | |
| 190 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 190 | + 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 191 | 191 | |
| 192 | 192 | 'am_time' => 'AM', |
| 193 | 193 | |
| 194 | 194 | 'pm_time' => 'PM', |
| 195 | 195 | |
| 196 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 196 | + 'end_of_days' => array('th', 'st', 'nd', 'rd'), |
|
| 197 | 197 | |
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | |
| 201 | - 'month_days_number' => array( 1 => 30, |
|
| 201 | + 'month_days_number' => array(1 => 30, |
|
| 202 | 202 | 2 => 29, |
| 203 | 203 | 3 => 30, |
| 204 | 204 | 4 => 30, |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | 9 => 30, |
| 210 | 210 | 10 => 29, |
| 211 | 211 | 11 => 30, |
| 212 | - 12 => 30 ), |
|
| 212 | + 12 => 30), |
|
| 213 | 213 | /************************************************************ |
| 214 | 214 | * Day of year |
| 215 | 215 | ************************************************************ |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | *\_________________________________________________________/ |
| 220 | 220 | */ |
| 221 | - 'day_of_year' => function ($date_time) { |
|
| 221 | + 'day_of_year' => function($date_time) { |
|
| 222 | 222 | |
| 223 | 223 | $result = null; |
| 224 | 224 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * example : al-Aḥad = result is 1 |
| 249 | 249 | *\_________________________________________________________/ |
| 250 | 250 | */ |
| 251 | - 'day_of_week' => function ($date_time, $day_of_week) { |
|
| 251 | + 'day_of_week' => function($date_time, $day_of_week) { |
|
| 252 | 252 | |
| 253 | 253 | $days_of_week = array( |
| 254 | 254 | 'al-Ithnayn', |
@@ -290,20 +290,20 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | *\_________________________________________________________/ |
| 292 | 292 | */ |
| 293 | - 'leap_year' => function ($year) { |
|
| 293 | + 'leap_year' => function($year) { |
|
| 294 | 294 | $result = $this->year % 30; |
| 295 | 295 | |
| 296 | - if (( 2 == $result ) |
|
| 297 | - || ( 5 == $result ) |
|
| 298 | - || ( 7 == $result ) |
|
| 299 | - || ( 10 == $result ) |
|
| 300 | - || ( 13 == $result ) |
|
| 301 | - || ( 16 == $result ) |
|
| 302 | - || ( 18 == $result ) |
|
| 303 | - || ( 21 == $result ) |
|
| 304 | - || ( 24 == $year ) |
|
| 305 | - || ( 26 == $result ) |
|
| 306 | - || ( 29 == $result ) |
|
| 296 | + if ((2 == $result) |
|
| 297 | + || (5 == $result) |
|
| 298 | + || (7 == $result) |
|
| 299 | + || (10 == $result) |
|
| 300 | + || (13 == $result) |
|
| 301 | + || (16 == $result) |
|
| 302 | + || (18 == $result) |
|
| 303 | + || (21 == $result) |
|
| 304 | + || (24 == $year) |
|
| 305 | + || (26 == $result) |
|
| 306 | + || (29 == $result) |
|
| 307 | 307 | ) { |
| 308 | 308 | return $result; |
| 309 | 309 | } |
@@ -317,6 +317,6 @@ discard block |
||
| 317 | 317 | * |
| 318 | 318 | *\_________________________________________________________/ |
| 319 | 319 | */ |
| 320 | - 'weekend' => array( 'friday', 'saturday' ), |
|
| 320 | + 'weekend' => array('friday', 'saturday'), |
|
| 321 | 321 | |
| 322 | 322 | ); |