@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'nowruz' => 'عید نوروز', |
|
| 5 | + 'events' => array( 'nowruz' => 'عید نوروز', |
|
| 6 | 6 | |
| 7 | 7 | 'iran_national_day' => 'روز جمهوری اسلامی', |
| 8 | 8 | |
@@ -12,16 +12,16 @@ discard block |
||
| 12 | 12 | 'month' => array( |
| 13 | 13 | 'فروردین', |
| 14 | 14 | 'اردیبهشت', |
| 15 | - 'خرداد', |
|
| 16 | - 'تیر', |
|
| 17 | - 'مرداد', |
|
| 18 | - 'شهریور', |
|
| 19 | - 'مهر', |
|
| 20 | - 'آبان', |
|
| 21 | - 'آذر', |
|
| 22 | - 'دی', |
|
| 23 | - 'بهمن', |
|
| 24 | - 'اسفند', |
|
| 15 | + 'خرداد', |
|
| 16 | + 'تیر', |
|
| 17 | + 'مرداد', |
|
| 18 | + 'شهریور', |
|
| 19 | + 'مهر', |
|
| 20 | + 'آبان', |
|
| 21 | + 'آذر', |
|
| 22 | + 'دی', |
|
| 23 | + 'بهمن', |
|
| 24 | + 'اسفند', |
|
| 25 | 25 | ), |
| 26 | 26 | |
| 27 | 27 | 'week_days_name' => array( |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'nowruz' => 'عید نوروز', |
|
| 5 | + 'events' => array('nowruz' => 'عید نوروز', |
|
| 6 | 6 | |
| 7 | 7 | 'iran_national_day' => 'روز جمهوری اسلامی', |
| 8 | 8 | |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | 'pm_time' => 'ب.ظ', |
| 42 | 42 | |
| 43 | - 'end_of_days' => array( "" ), |
|
| 43 | + 'end_of_days' => array(""), |
|
| 44 | 44 | |
| 45 | - 'numbers' => array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' ), |
|
| 45 | + 'numbers' => array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'), |
|
| 46 | 46 | '0' => '۰', |
| 47 | 47 | '1' => '۱', |
| 48 | 48 | '2' => '۲', |
@@ -2,23 +2,23 @@ |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
| 5 | + 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
| 6 | 6 | |
| 7 | 7 | ), |
| 8 | 8 | |
| 9 | 9 | 'month' => array( |
| 10 | 10 | 'مُحَرَّم', |
| 11 | 11 | 'صَفَر', |
| 12 | - 'رَبيع الأوّل', |
|
| 13 | - 'رَبيع الآخر', |
|
| 14 | - 'جُمادى الأولى', |
|
| 15 | - 'جُمادى الآخرة', |
|
| 16 | - 'رَجَب', |
|
| 17 | - 'شَعْبان', |
|
| 18 | - 'رَمَضان', |
|
| 19 | - 'شَوّال', |
|
| 20 | - 'ذو القِعْدة', |
|
| 21 | - 'ذو الحِجّة' |
|
| 12 | + 'رَبيع الأوّل', |
|
| 13 | + 'رَبيع الآخر', |
|
| 14 | + 'جُمادى الأولى', |
|
| 15 | + 'جُمادى الآخرة', |
|
| 16 | + 'رَجَب', |
|
| 17 | + 'شَعْبان', |
|
| 18 | + 'رَمَضان', |
|
| 19 | + 'شَوّال', |
|
| 20 | + 'ذو القِعْدة', |
|
| 21 | + 'ذو الحِجّة' |
|
| 22 | 22 | ), |
| 23 | 23 | |
| 24 | 24 | 'days_of_week' => array( |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | 4 | |
| 5 | - 'events' => array( 'eid fitr' => 'عيد الفطر', |
|
| 5 | + 'events' => array('eid fitr' => 'عيد الفطر', |
|
| 6 | 6 | |
| 7 | 7 | ), |
| 8 | 8 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | 'pm_time' => '', |
| 39 | 39 | |
| 40 | - 'end_of_days' => array( "" ), |
|
| 40 | + 'end_of_days' => array(""), |
|
| 41 | 41 | |
| 42 | - 'numbers' => array( '۰', '۱', '۲', '۳', '٤', '٥', '٦', '۷', '۸', '۹'), |
|
| 42 | + 'numbers' => array('۰', '۱', '۲', '۳', '٤', '٥', '٦', '۷', '۸', '۹'), |
|
| 43 | 43 | |
| 44 | 44 | ); |
| 45 | 45 | |
@@ -1,7 +1,5 @@ |
||
| 1 | 1 | ``<?php |
| 2 | 2 | |
| 3 | - use OpenCafe\Datium as Datium; |
|
| 4 | - |
|
| 5 | 3 | return array ( |
| 6 | 4 | |
| 7 | 5 | 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - use OpenCafe\Datium as Datium; |
|
| 3 | + use OpenCafe\Datium as Datium; |
|
| 4 | 4 | |
| 5 | - return [ |
|
| 5 | + return [ |
|
| 6 | 6 | |
| 7 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 7 | + 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 8 | 8 | |
| 9 | - 'am_time' => 'AM', |
|
| 9 | + 'am_time' => 'AM', |
|
| 10 | 10 | |
| 11 | - 'pm_time' => 'PM', |
|
| 11 | + 'pm_time' => 'PM', |
|
| 12 | 12 | |
| 13 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 13 | + 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | |
| 17 | - /************************************************************ |
|
| 17 | + /************************************************************ |
|
| 18 | 18 | * Convert to |
| 19 | 19 | ************************************************************ |
| 20 | 20 | * |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | *\_________________________________________________________/ |
| 24 | 24 | */ |
| 25 | - 'convert_to' => function ($date_time) { |
|
| 25 | + 'convert_to' => function ($date_time) { |
|
| 26 | 26 | |
| 27 | - return null; |
|
| 27 | + return null; |
|
| 28 | 28 | |
| 29 | - }, |
|
| 29 | + }, |
|
| 30 | 30 | |
| 31 | 31 | /************************************************************ |
| 32 | 32 | * Convert From |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | 'December' |
| 88 | 88 | |
| 89 | - ), |
|
| 89 | + ), |
|
| 90 | 90 | |
| 91 | 91 | /************************************************************ |
| 92 | 92 | * Days of Week |
@@ -99,28 +99,28 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | 'days_of_week' => array ( |
| 101 | 101 | |
| 102 | - 'Monday', |
|
| 103 | - 'Tuesday', |
|
| 104 | - 'Wednesday', |
|
| 105 | - 'Thursday', |
|
| 106 | - 'Friday', |
|
| 107 | - 'Saturday', |
|
| 108 | - 'Sunday', |
|
| 102 | + 'Monday', |
|
| 103 | + 'Tuesday', |
|
| 104 | + 'Wednesday', |
|
| 105 | + 'Thursday', |
|
| 106 | + 'Friday', |
|
| 107 | + 'Saturday', |
|
| 108 | + 'Sunday', |
|
| 109 | 109 | ), |
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | 'month_days_number' => array( 1 => 31, |
| 113 | - 2 => 28, |
|
| 114 | - 3 => 31, |
|
| 115 | - 4 => 30, |
|
| 116 | - 5 => 31, |
|
| 117 | - 6 => 30, |
|
| 118 | - 7 => 31, |
|
| 119 | - 8 => 31, |
|
| 120 | - 9 => 30, |
|
| 121 | - 10 => 31, |
|
| 122 | - 11 => 30, |
|
| 123 | - 12 => 30 ), |
|
| 113 | + 2 => 28, |
|
| 114 | + 3 => 31, |
|
| 115 | + 4 => 30, |
|
| 116 | + 5 => 31, |
|
| 117 | + 6 => 30, |
|
| 118 | + 7 => 31, |
|
| 119 | + 8 => 31, |
|
| 120 | + 9 => 30, |
|
| 121 | + 10 => 31, |
|
| 122 | + 11 => 30, |
|
| 123 | + 12 => 30 ), |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | 'day_of_year' => function ($date_time) { |
@@ -4,13 +4,13 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | return [ |
| 6 | 6 | |
| 7 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 7 | + 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 8 | 8 | |
| 9 | 9 | 'am_time' => 'AM', |
| 10 | 10 | |
| 11 | 11 | 'pm_time' => 'PM', |
| 12 | 12 | |
| 13 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 13 | + 'end_of_days' => array('th', 'st', 'nd', 'rd'), |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | *\_________________________________________________________/ |
| 24 | 24 | */ |
| 25 | - 'convert_to' => function ($date_time) { |
|
| 25 | + 'convert_to' => function($date_time) { |
|
| 26 | 26 | |
| 27 | 27 | return null; |
| 28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | *\_________________________________________________________/ |
| 38 | 38 | */ |
| 39 | - 'convert_from' => function ($date_time) { |
|
| 39 | + 'convert_from' => function($date_time) { |
|
| 40 | 40 | |
| 41 | 41 | return null; |
| 42 | 42 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | *\_________________________________________________________/ |
| 99 | 99 | */ |
| 100 | - 'days_of_week' => array ( |
|
| 100 | + 'days_of_week' => array( |
|
| 101 | 101 | |
| 102 | 102 | 'Monday', |
| 103 | 103 | 'Tuesday', |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | ), |
| 110 | 110 | |
| 111 | 111 | |
| 112 | - 'month_days_number' => array( 1 => 31, |
|
| 112 | + 'month_days_number' => array(1 => 31, |
|
| 113 | 113 | 2 => 28, |
| 114 | 114 | 3 => 31, |
| 115 | 115 | 4 => 30, |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | 9 => 30, |
| 121 | 121 | 10 => 31, |
| 122 | 122 | 11 => 30, |
| 123 | - 12 => 30 ), |
|
| 123 | + 12 => 30), |
|
| 124 | 124 | |
| 125 | 125 | |
| 126 | - 'day_of_year' => function ($date_time) { |
|
| 126 | + 'day_of_year' => function($date_time) { |
|
| 127 | 127 | |
| 128 | 128 | $result = null; |
| 129 | 129 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | }, |
| 149 | 149 | |
| 150 | - 'day_of_week' => function ($date_time) { |
|
| 150 | + 'day_of_week' => function($date_time) { |
|
| 151 | 151 | |
| 152 | 152 | $config = include 'Gregorian.php'; |
| 153 | 153 | |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | *\_________________________________________________________/ |
| 171 | 171 | */ |
| 172 | - 'leap_year' => function ($year) { |
|
| 172 | + 'leap_year' => function($year) { |
|
| 173 | 173 | |
| 174 | - return ( ( ( $year % 4 ) == 0 ) && ( ( ( $year % 100 ) != 0 ) || ( ( $year % 400 ) == 0 ) ) ); |
|
| 174 | + return ((($year % 4) == 0) && ((($year % 100) != 0) || (($year % 400) == 0))); |
|
| 175 | 175 | |
| 176 | 176 | }, |
| 177 | 177 | |
@@ -183,6 +183,6 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | *\_________________________________________________________/ |
| 185 | 185 | */ |
| 186 | - 'weekend' => array( 'saturday', 'sunday' ), |
|
| 186 | + 'weekend' => array('saturday', 'sunday'), |
|
| 187 | 187 | |
| 188 | 188 | ]; |
@@ -64,6 +64,10 @@ |
||
| 64 | 64 | * |
| 65 | 65 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
| 66 | 66 | */ |
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @param \DateTime $date_time |
|
| 70 | + */ |
|
| 67 | 71 | public function __construct( $date_time = null ) |
| 68 | 72 | { |
| 69 | 73 | |
@@ -12,48 +12,48 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @var integer |
|
| 16 | - */ |
|
| 15 | + * @var integer |
|
| 16 | + */ |
|
| 17 | 17 | protected $year; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @var integer |
|
| 21 | - */ |
|
| 20 | + * @var integer |
|
| 21 | + */ |
|
| 22 | 22 | protected $month; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * @var $day |
|
| 26 | - */ |
|
| 25 | + * @var $day |
|
| 26 | + */ |
|
| 27 | 27 | protected $day; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * @var DateTime |
|
| 31 | - */ |
|
| 30 | + * @var DateTime |
|
| 31 | + */ |
|
| 32 | 32 | public $date_time; |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @var array |
|
| 36 | - */ |
|
| 35 | + * @var array |
|
| 36 | + */ |
|
| 37 | 37 | protected $config; |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * @var integer |
|
| 41 | - */ |
|
| 40 | + * @var integer |
|
| 41 | + */ |
|
| 42 | 42 | protected $leap; |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * @var integer |
|
| 46 | - */ |
|
| 45 | + * @var integer |
|
| 46 | + */ |
|
| 47 | 47 | protected $temp_day; |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * @var DateTime |
|
| 51 | - */ |
|
| 50 | + * @var DateTime |
|
| 51 | + */ |
|
| 52 | 52 | protected $date; |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * @var array |
|
| 56 | - */ |
|
| 55 | + * @var array |
|
| 56 | + */ |
|
| 57 | 57 | protected $calendar_file; |
| 58 | 58 | |
| 59 | 59 | /************************************************************ |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | - *convert jalali year to gregorian year |
|
| 108 | - * |
|
| 109 | - * @since Oct, 16 2015 |
|
| 110 | - * @return object |
|
| 111 | - */ |
|
| 107 | + *convert jalali year to gregorian year |
|
| 108 | + * |
|
| 109 | + * @since Oct, 16 2015 |
|
| 110 | + * @return object |
|
| 111 | + */ |
|
| 112 | 112 | public function jalaliToGregorian( $date_time ) |
| 113 | 113 | { |
| 114 | 114 | |
@@ -172,16 +172,16 @@ discard block |
||
| 172 | 172 | $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
| 173 | 173 | |
| 174 | 174 | |
| 175 | - return $this->date_time; |
|
| 175 | + return $this->date_time; |
|
| 176 | 176 | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | - *convert jalali year to hijri year |
|
| 181 | - * |
|
| 182 | - * @since Oct, 17 2015 |
|
| 183 | - * @return object |
|
| 184 | - */ |
|
| 180 | + *convert jalali year to hijri year |
|
| 181 | + * |
|
| 182 | + * @since Oct, 17 2015 |
|
| 183 | + * @return object |
|
| 184 | + */ |
|
| 185 | 185 | public function jalaliToHijri( $date_time ) |
| 186 | 186 | { |
| 187 | 187 | |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $this->temp_day += $this->day; |
|
| 206 | + $this->temp_day += $this->day; |
|
| 207 | 207 | |
| 208 | - $this->leap = new Leap($this->year); |
|
| 208 | + $this->leap = new Leap($this->year); |
|
| 209 | 209 | |
| 210 | 210 | if ($this->leap->get() && $this->month > 11 ) { $this->temp_day++; |
| 211 | 211 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | $_month = $_year[1]; |
| 220 | 220 | |
| 221 | - $var_temp = '0.0'; |
|
| 221 | + $var_temp = '0.0'; |
|
| 222 | 222 | |
| 223 | 223 | for ( $i = strlen($_month); $i > 2; $i-- ) { |
| 224 | 224 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - $var_temp .= '1'; |
|
| 229 | + $var_temp .= '1'; |
|
| 230 | 230 | |
| 231 | 231 | $_month = $_month * $var_temp ; |
| 232 | 232 | |
@@ -256,18 +256,18 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $this->day = $_day[0]; |
| 258 | 258 | |
| 259 | - $this->date_time->setDate($this->year, $this->month, $this->day); |
|
| 259 | + $this->date_time->setDate($this->year, $this->month, $this->day); |
|
| 260 | 260 | |
| 261 | - return $this->date_time; |
|
| 261 | + return $this->date_time; |
|
| 262 | 262 | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | - *convert hijri year to jalali year |
|
| 267 | - * |
|
| 268 | - * @since Oct, 17 2015 |
|
| 269 | - * @return object |
|
| 270 | - */ |
|
| 266 | + *convert hijri year to jalali year |
|
| 267 | + * |
|
| 268 | + * @since Oct, 17 2015 |
|
| 269 | + * @return object |
|
| 270 | + */ |
|
| 271 | 271 | public function hijriToJalali( $date_time ) |
| 272 | 272 | { |
| 273 | 273 | |
@@ -320,16 +320,16 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $this->date_time->setDate($jalali_year, $jalali_month, $jalali_day); |
| 322 | 322 | |
| 323 | - return $this->date_time; |
|
| 323 | + return $this->date_time; |
|
| 324 | 324 | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
| 328 | - * convert hijri year to gregorian year |
|
| 329 | - * |
|
| 330 | - * @since Oct, 17 2015 |
|
| 331 | - * @return object |
|
| 332 | - */ |
|
| 328 | + * convert hijri year to gregorian year |
|
| 329 | + * |
|
| 330 | + * @since Oct, 17 2015 |
|
| 331 | + * @return object |
|
| 332 | + */ |
|
| 333 | 333 | public function hijriToGregorian( $date_time ) |
| 334 | 334 | { |
| 335 | 335 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
| 384 | 384 | |
| 385 | - return $this->date_time; |
|
| 385 | + return $this->date_time; |
|
| 386 | 386 | |
| 387 | 387 | } |
| 388 | 388 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | public function from($calendar) |
| 79 | 79 | { |
| 80 | 80 | |
| 81 | - $this->calendar_file = include __DIR__.'/CalendarSettings/' . ucfirst($calendar) . '.php'; |
|
| 81 | + $this->calendar_file = include __DIR__.'/CalendarSettings/'.ucfirst($calendar).'.php'; |
|
| 82 | 82 | |
| 83 | - return $this->calendar_file[ 'convert_from' ]( $this->date_time ); |
|
| 83 | + return $this->calendar_file['convert_from']($this->date_time); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | public function to($calendar) |
| 96 | 96 | { |
| 97 | 97 | |
| 98 | - $this->calendar_file = include __DIR__.'/CalendarSettings/' . ucfirst($calendar) . '.php'; |
|
| 98 | + $this->calendar_file = include __DIR__.'/CalendarSettings/'.ucfirst($calendar).'.php'; |
|
| 99 | 99 | |
| 100 | - return $this->calendar_file[ 'convert_to' ]( $this->date_time ); |
|
| 100 | + return $this->calendar_file['convert_to']($this->date_time); |
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $days_of_year = 0; |
| 124 | 124 | |
| 125 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 125 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 126 | 126 | if ($this->month > $month) { |
| 127 | 127 | $days_of_year += $value; |
| 128 | 128 | } |
@@ -130,25 +130,25 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $days_of_year += $this->day; |
| 132 | 132 | |
| 133 | - $days_of_leap_years = intval(( ( $this->year - 1 ) / 4 )); |
|
| 133 | + $days_of_leap_years = intval((($this->year - 1) / 4)); |
|
| 134 | 134 | |
| 135 | - $days_of_jalali_years = ( ( ( $this->year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years ); |
|
| 135 | + $days_of_jalali_years = ((($this->year - 1) * 365) + $days_of_year + $days_of_leap_years); |
|
| 136 | 136 | |
| 137 | 137 | $days_of_gregorain_years = $days_of_jalali_years + 226899; |
| 138 | 138 | |
| 139 | 139 | if ($this->month < 10) { |
| 140 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 621 ) / 4 )); |
|
| 141 | - } elseif (( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 )) { |
|
| 142 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 622 ) / 4 )); |
|
| 140 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 621) / 4)); |
|
| 141 | + } elseif (((10 == $this->month) && ($this->day > 10)) || ($this->month > 10)) { |
|
| 142 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 622) / 4)); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
| 145 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
| 146 | 146 | |
| 147 | 147 | $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
| 148 | 148 | |
| 149 | 149 | $this->config = include __DIR__.'/Gregorian.php'; |
| 150 | 150 | |
| 151 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 151 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 152 | 152 | if ($gregorian_month < $value) { |
| 153 | 153 | break; |
| 154 | 154 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $this->day = $this->date_time->format('d'); |
| 186 | 186 | |
| 187 | - $this->temp_day = 0 ; |
|
| 187 | + $this->temp_day = 0; |
|
| 188 | 188 | |
| 189 | 189 | $this->config = include __DIR__.'/Jalali.php'; |
| 190 | 190 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $this->temp_day++; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
|
| 203 | + $_year = ((((($this->year - 1) * 365.2422) + $this->temp_day) - 119) / 354.3670) + 1; |
|
| 204 | 204 | |
| 205 | 205 | $_year = explode('.', $_year); |
| 206 | 206 | |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | $var_temp .= '1'; |
| 218 | 218 | |
| 219 | - $_month = $_month * $var_temp ; |
|
| 219 | + $_month = $_month * $var_temp; |
|
| 220 | 220 | |
| 221 | - $_month = ( $_month * 12 ) + 1; |
|
| 221 | + $_month = ($_month * 12) + 1; |
|
| 222 | 222 | |
| 223 | 223 | $_month = explode('.', $_month); |
| 224 | 224 | |
@@ -229,14 +229,14 @@ discard block |
||
| 229 | 229 | $var_temp = '0.0'; |
| 230 | 230 | |
| 231 | 231 | for ($i = strlen($_day); $i > 2; $i--) { |
| 232 | - $var_temp .= '0' ; |
|
| 232 | + $var_temp .= '0'; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $var_temp .= '1'; |
| 236 | 236 | |
| 237 | 237 | $_day = $_day * $var_temp; |
| 238 | 238 | |
| 239 | - $_day = ( $_day * 29.530 ); |
|
| 239 | + $_day = ($_day * 29.530); |
|
| 240 | 240 | |
| 241 | 241 | $_day = explode('.', $_day); |
| 242 | 242 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | $this->config = include __DIR__.'/Hijri.php'; |
| 271 | 271 | |
| 272 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 272 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 273 | 273 | if ($this->month > $month) { |
| 274 | 274 | $days_of_year += $value; |
| 275 | 275 | } |
@@ -277,21 +277,21 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | $days_of_year += $this->day; |
| 279 | 279 | |
| 280 | - $days_of_leap_years = intval(( ( $this->year - 1 ) / 3 )); |
|
| 280 | + $days_of_leap_years = intval((($this->year - 1) / 3)); |
|
| 281 | 281 | |
| 282 | - $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
| 282 | + $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
| 283 | 283 | |
| 284 | 284 | $days_of_jalali_years = $days_of_hijri_years + 179; |
| 285 | 285 | |
| 286 | - $days_of_jalali_years = $days_of_jalali_years - intval(( ( $this->year - 43 ) / 4 )); |
|
| 286 | + $days_of_jalali_years = $days_of_jalali_years - intval((($this->year - 43) / 4)); |
|
| 287 | 287 | |
| 288 | - $jalali_month = ( $days_of_jalali_years % 365 ); |
|
| 288 | + $jalali_month = ($days_of_jalali_years % 365); |
|
| 289 | 289 | |
| 290 | 290 | $jalali_year = intval($days_of_jalali_years / 365) + 1; |
| 291 | 291 | |
| 292 | 292 | $this->config = include __DIR__.'/Jalali.php'; |
| 293 | 293 | |
| 294 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 294 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 295 | 295 | if ($jalali_month < $value) { |
| 296 | 296 | break; |
| 297 | 297 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | $this->config = include __DIR__.'/Hijri.php'; |
| 332 | 332 | |
| 333 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 333 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 334 | 334 | if ($this->month > $month) { |
| 335 | 335 | $days_of_year += $value; |
| 336 | 336 | } |
@@ -338,21 +338,21 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $days_of_year += $this->day; |
| 340 | 340 | |
| 341 | - $days_of_leap_years = intval(( ( $this->year - 1 ) / 3 )); |
|
| 341 | + $days_of_leap_years = intval((($this->year - 1) / 3)); |
|
| 342 | 342 | |
| 343 | - $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
| 343 | + $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
| 344 | 344 | |
| 345 | 345 | $days_of_gregorain_years = $days_of_hijri_years + 227078; |
| 346 | 346 | |
| 347 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 578 ) / 4 )); |
|
| 347 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 578) / 4)); |
|
| 348 | 348 | |
| 349 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
| 349 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
| 350 | 350 | |
| 351 | 351 | $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
| 352 | 352 | |
| 353 | 353 | $this->config = include __DIR__.'/Gregorian.php'; |
| 354 | 354 | |
| 355 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 355 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 356 | 356 | if ($gregorian_month < $value) { |
| 357 | 357 | break; |
| 358 | 358 | } |
@@ -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 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * Fetch translated expression to langTable attribute |
| 51 | 51 | */ |
| 52 | - self::$langTable = include __DIR__ . '/lang/' . $language . '/general.php'; |
|
| 52 | + self::$langTable = include __DIR__.'/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 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public static function get($lang, $value) |
| 72 | 72 | { |
| 73 | 73 | |
| 74 | - $file = include( __DIR__ . '/lang/' . $lang . '/general.php'); |
|
| 74 | + $file = include(__DIR__.'/lang/'.$lang.'/general.php'); |
|
| 75 | 75 | |
| 76 | 76 | return $file[$value]; |
| 77 | 77 | |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | * @param integer $numbers |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - public static function getNumbers( $lang, $numbers ) |
|
| 86 | + public static function getNumbers($lang, $numbers) |
|
| 87 | 87 | { |
| 88 | 88 | |
| 89 | 89 | $result = null; |
| 90 | 90 | |
| 91 | - $file = include( __DIR__ . '/lang/' . $lang . '/general.php'); |
|
| 91 | + $file = include(__DIR__.'/lang/'.$lang.'/general.php'); |
|
| 92 | 92 | |
| 93 | - foreach( str_split( $numbers, 1 ) as $key => $value ) { |
|
| 93 | + foreach (str_split($numbers, 1) as $key => $value) { |
|
| 94 | 94 | |
| 95 | 95 | $result .= $file[$value]; |
| 96 | 96 | |
@@ -7,43 +7,43 @@ |
||
| 7 | 7 | { |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * @param integer store year value |
|
| 11 | - */ |
|
| 10 | + * @param integer store year value |
|
| 11 | + */ |
|
| 12 | 12 | protected $year; |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * @param string store type of year value |
|
| 16 | - */ |
|
| 15 | + * @param string store type of year value |
|
| 16 | + */ |
|
| 17 | 17 | protected $type; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @param boolean store result of leap functions |
|
| 21 | - */ |
|
| 20 | + * @param boolean store result of leap functions |
|
| 21 | + */ |
|
| 22 | 22 | protected $result; |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * @param $year integer |
|
| 27 | - * @since Aug, 21 2015 |
|
| 28 | - */ |
|
| 26 | + * @param $year integer |
|
| 27 | + * @since Aug, 21 2015 |
|
| 28 | + */ |
|
| 29 | 29 | public function __construct($year, $type = 'gregorian') |
| 30 | 30 | { |
| 31 | 31 | |
| 32 | - $this->year = $year; |
|
| 32 | + $this->year = $year; |
|
| 33 | 33 | |
| 34 | - $this->type = $type; |
|
| 34 | + $this->type = $type; |
|
| 35 | 35 | |
| 36 | - return $this; |
|
| 36 | + return $this; |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * return the year is leap or not |
|
| 43 | - * |
|
| 44 | - * @since Aug, 21 2015 |
|
| 45 | - * @return boolean |
|
| 46 | - */ |
|
| 42 | + * return the year is leap or not |
|
| 43 | + * |
|
| 44 | + * @since Aug, 21 2015 |
|
| 45 | + * @return boolean |
|
| 46 | + */ |
|
| 47 | 47 | public function get() |
| 48 | 48 | { |
| 49 | 49 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | public function get() |
| 48 | 48 | { |
| 49 | 49 | |
| 50 | - $this->result = include 'CalendarSettings/' . ucfirst($this->type) . '.php'; |
|
| 50 | + $this->result = include 'CalendarSettings/'.ucfirst($this->type).'.php'; |
|
| 51 | 51 | |
| 52 | 52 | return $this->result['leap_year']($this->year); |
| 53 | 53 | |
@@ -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 |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | 'Dhu al_Hijjah' |
| 169 | 169 | |
| 170 | - ), |
|
| 170 | + ), |
|
| 171 | 171 | |
| 172 | 172 | /************************************************************ |
| 173 | 173 | * Days of Week |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | *\_________________________________________________________/ |
| 180 | 180 | */ |
| 181 | 181 | 'days_of_week' => array ( |
| 182 | - 'al-Aḥad', |
|
| 183 | - 'al-Ithnayn', |
|
| 184 | - 'ath-Thulatha\'', |
|
| 185 | - 'al-Arbi\'a', |
|
| 186 | - 'al-Khamees', |
|
| 187 | - 'al-Jumu\'ah', |
|
| 188 | - 'as-Sabt', |
|
| 182 | + 'al-Aḥad', |
|
| 183 | + 'al-Ithnayn', |
|
| 184 | + 'ath-Thulatha\'', |
|
| 185 | + 'al-Arbi\'a', |
|
| 186 | + 'al-Khamees', |
|
| 187 | + 'al-Jumu\'ah', |
|
| 188 | + 'as-Sabt', |
|
| 189 | 189 | |
| 190 | 190 | ), |
| 191 | 191 | |
@@ -201,17 +201,17 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | |
| 203 | 203 | 'month_days_number' => array( 1 => 30, |
| 204 | - 2 => 29, |
|
| 205 | - 3 => 30, |
|
| 206 | - 4 => 30, |
|
| 207 | - 5 => 29, |
|
| 208 | - 6 => 29, |
|
| 209 | - 7 => 30, |
|
| 210 | - 8 => 29, |
|
| 211 | - 9 => 30, |
|
| 212 | - 10 => 29, |
|
| 213 | - 11 => 30, |
|
| 214 | - 12 => 30 ), |
|
| 204 | + 2 => 29, |
|
| 205 | + 3 => 30, |
|
| 206 | + 4 => 30, |
|
| 207 | + 5 => 29, |
|
| 208 | + 6 => 29, |
|
| 209 | + 7 => 30, |
|
| 210 | + 8 => 29, |
|
| 211 | + 9 => 30, |
|
| 212 | + 10 => 29, |
|
| 213 | + 11 => 30, |
|
| 214 | + 12 => 30 ), |
|
| 215 | 215 | /************************************************************ |
| 216 | 216 | * Day of year |
| 217 | 217 | ************************************************************ |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | *\_________________________________________________________/ |
| 222 | 222 | */ |
| 223 | - 'day_of_year' => function ($date_time) { |
|
| 223 | + 'day_of_year' => function ($date_time) { |
|
| 224 | 224 | |
| 225 | 225 | $result = null; |
| 226 | 226 | |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | return $result; |
| 242 | 242 | |
| 243 | - }, |
|
| 243 | + }, |
|
| 244 | 244 | |
| 245 | - /************************************************************ |
|
| 245 | + /************************************************************ |
|
| 246 | 246 | * Day of week |
| 247 | 247 | ************************************************************ |
| 248 | 248 | * |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * example : al-Aḥad = result is 1 |
| 251 | 251 | *\_________________________________________________________/ |
| 252 | 252 | */ |
| 253 | - 'day_of_week' => function ($date_time) { |
|
| 253 | + 'day_of_week' => function ($date_time) { |
|
| 254 | 254 | |
| 255 | 255 | $configGhamari = include 'Hijri.php'; |
| 256 | 256 | |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - }, |
|
| 269 | + }, |
|
| 270 | 270 | |
| 271 | - /************************************************************ |
|
| 271 | + /************************************************************ |
|
| 272 | 272 | * Leap year |
| 273 | 273 | ************************************************************ |
| 274 | 274 | * |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | *\_________________________________________________________/ |
| 278 | 278 | */ |
| 279 | - 'leap_year' => function ($year) { |
|
| 279 | + 'leap_year' => function ($year) { |
|
| 280 | 280 | $result = $this->year % 30; |
| 281 | 281 | |
| 282 | 282 | if (( 2 == $result ) |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | ) { |
| 294 | 294 | return $result; |
| 295 | 295 | } |
| 296 | - }, |
|
| 296 | + }, |
|
| 297 | 297 | |
| 298 | 298 | /************************************************************ |
| 299 | 299 | * 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 | |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $day = $date_time->format('d'); |
| 107 | 107 | |
| 108 | - $jd = (int)((11 * $year + 3) / 30) + 354 * $year + |
|
| 109 | - 30 * $month -(int)(($month - 1) / 2) + $day + 1948440 - 385; |
|
| 108 | + $jd = (int) ((11 * $year + 3) / 30) + 354 * $year + |
|
| 109 | + 30 * $month - (int) (($month - 1) / 2) + $day + 1948440 - 385; |
|
| 110 | 110 | |
| 111 | 111 | $result = explode('/', jdtogregorian($jd)); |
| 112 | 112 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | *\_________________________________________________________/ |
| 143 | 143 | */ |
| 144 | - 'month' => array ( |
|
| 144 | + 'month' => array( |
|
| 145 | 145 | |
| 146 | 146 | 'Muharram', |
| 147 | 147 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | *\_________________________________________________________/ |
| 180 | 180 | */ |
| 181 | - 'days_of_week' => array ( |
|
| 181 | + 'days_of_week' => array( |
|
| 182 | 182 | 'al-Aḥad', |
| 183 | 183 | 'al-Ithnayn', |
| 184 | 184 | 'ath-Thulatha\'', |
@@ -189,18 +189,18 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | ), |
| 191 | 191 | |
| 192 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 192 | + 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), |
|
| 193 | 193 | |
| 194 | 194 | 'am_time' => 'AM', |
| 195 | 195 | |
| 196 | 196 | 'pm_time' => 'PM', |
| 197 | 197 | |
| 198 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), |
|
| 198 | + 'end_of_days' => array('th', 'st', 'nd', 'rd'), |
|
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | |
| 203 | - 'month_days_number' => array( 1 => 30, |
|
| 203 | + 'month_days_number' => array(1 => 30, |
|
| 204 | 204 | 2 => 29, |
| 205 | 205 | 3 => 30, |
| 206 | 206 | 4 => 30, |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | 9 => 30, |
| 212 | 212 | 10 => 29, |
| 213 | 213 | 11 => 30, |
| 214 | - 12 => 30 ), |
|
| 214 | + 12 => 30), |
|
| 215 | 215 | /************************************************************ |
| 216 | 216 | * Day of year |
| 217 | 217 | ************************************************************ |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | *\_________________________________________________________/ |
| 222 | 222 | */ |
| 223 | - 'day_of_year' => function ($date_time) { |
|
| 223 | + 'day_of_year' => function($date_time) { |
|
| 224 | 224 | |
| 225 | 225 | $result = null; |
| 226 | 226 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * example : al-Aḥad = result is 1 |
| 251 | 251 | *\_________________________________________________________/ |
| 252 | 252 | */ |
| 253 | - 'day_of_week' => function ($date_time) { |
|
| 253 | + 'day_of_week' => function($date_time) { |
|
| 254 | 254 | |
| 255 | 255 | $configGhamari = include 'Hijri.php'; |
| 256 | 256 | |
@@ -276,20 +276,20 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | *\_________________________________________________________/ |
| 278 | 278 | */ |
| 279 | - 'leap_year' => function ($year) { |
|
| 279 | + 'leap_year' => function($year) { |
|
| 280 | 280 | $result = $this->year % 30; |
| 281 | 281 | |
| 282 | - if (( 2 == $result ) |
|
| 283 | - || ( 5 == $result ) |
|
| 284 | - || ( 7 == $result ) |
|
| 285 | - || ( 10 == $result ) |
|
| 286 | - || ( 13 == $result ) |
|
| 287 | - || ( 16 == $result ) |
|
| 288 | - || ( 18 == $result ) |
|
| 289 | - || ( 21 == $result ) |
|
| 290 | - || ( 24 == $year ) |
|
| 291 | - || ( 26 == $result ) |
|
| 292 | - || ( 29 == $result ) |
|
| 282 | + if ((2 == $result) |
|
| 283 | + || (5 == $result) |
|
| 284 | + || (7 == $result) |
|
| 285 | + || (10 == $result) |
|
| 286 | + || (13 == $result) |
|
| 287 | + || (16 == $result) |
|
| 288 | + || (18 == $result) |
|
| 289 | + || (21 == $result) |
|
| 290 | + || (24 == $year) |
|
| 291 | + || (26 == $result) |
|
| 292 | + || (29 == $result) |
|
| 293 | 293 | ) { |
| 294 | 294 | return $result; |
| 295 | 295 | } |
@@ -303,6 +303,6 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | *\_________________________________________________________/ |
| 305 | 305 | */ |
| 306 | - 'weekend' => array( 'friday', 'saturday' ), |
|
| 306 | + 'weekend' => array('friday', 'saturday'), |
|
| 307 | 307 | |
| 308 | 308 | ); |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $temp_day += $config[ 'month_days_number' ][ $i ]; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $temp_day += $day; |
|
| 48 | + $temp_day += $day; |
|
| 49 | 49 | |
| 50 | - $leap = new Leap($year); |
|
| 50 | + $leap = new Leap($year); |
|
| 51 | 51 | |
| 52 | 52 | if ($leap->get() && $month > 2) { |
| 53 | 53 | $temp_day++; |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $date_time->setDate($year, $month, $day); |
|
| 104 | + $date_time->setDate($year, $month, $day); |
|
| 105 | 105 | |
| 106 | - return $date_time; |
|
| 106 | + return $date_time; |
|
| 107 | 107 | |
| 108 | 108 | }, |
| 109 | 109 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day); |
| 169 | 169 | |
| 170 | 170 | |
| 171 | - return $date_time; |
|
| 171 | + return $date_time; |
|
| 172 | 172 | |
| 173 | 173 | }, |
| 174 | 174 | |
@@ -231,30 +231,30 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | 'days_of_week' => array ( |
| 233 | 233 | |
| 234 | - 'Yekshanbe', |
|
| 235 | - 'Doshanbe', |
|
| 236 | - 'Seshanbe', |
|
| 237 | - 'Chaharshanbe', |
|
| 238 | - 'Panjshanbe', |
|
| 239 | - 'Jome', |
|
| 240 | - 'Shanbe', |
|
| 234 | + 'Yekshanbe', |
|
| 235 | + 'Doshanbe', |
|
| 236 | + 'Seshanbe', |
|
| 237 | + 'Chaharshanbe', |
|
| 238 | + 'Panjshanbe', |
|
| 239 | + 'Jome', |
|
| 240 | + 'Shanbe', |
|
| 241 | 241 | |
| 242 | 242 | ), |
| 243 | 243 | |
| 244 | 244 | 'start_day_of_week' => 'Shanbe', |
| 245 | 245 | |
| 246 | 246 | 'month_days_number' => array( 1 => 31, |
| 247 | - 2 => 31, |
|
| 248 | - 3 => 31, |
|
| 249 | - 4 => 31, |
|
| 250 | - 5 => 31, |
|
| 251 | - 6 => 31, |
|
| 252 | - 7 => 30, |
|
| 253 | - 8 => 30, |
|
| 254 | - 9 => 30, |
|
| 255 | - 10 => 30, |
|
| 256 | - 11 => 30, |
|
| 257 | - 12 => 29 ), |
|
| 247 | + 2 => 31, |
|
| 248 | + 3 => 31, |
|
| 249 | + 4 => 31, |
|
| 250 | + 5 => 31, |
|
| 251 | + 6 => 31, |
|
| 252 | + 7 => 30, |
|
| 253 | + 8 => 30, |
|
| 254 | + 9 => 30, |
|
| 255 | + 10 => 30, |
|
| 256 | + 11 => 30, |
|
| 257 | + 12 => 29 ), |
|
| 258 | 258 | |
| 259 | 259 | /************************************************************ |
| 260 | 260 | * Day of year |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | 'leap_year' => function ( $year ) { |
| 326 | 326 | |
| 327 | - $a = 0.025; |
|
| 327 | + $a = 0.025; |
|
| 328 | 328 | |
| 329 | - $b = 266; |
|
| 329 | + $b = 266; |
|
| 330 | 330 | |
| 331 | 331 | if ($year > 0) { |
| 332 | 332 | $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; // 0.24219 ~ extra days of one year |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | return false; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
| 342 | - $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
| 341 | + $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
| 342 | + $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
| 343 | 343 | |
| 344 | 344 | if ($frac0 <= $b && $frac1 > $b) { |
| 345 | 345 | return true; |
@@ -360,4 +360,4 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | 'weekend' => array( 'friday' ) |
| 362 | 362 | |
| 363 | - ); |
|
| 363 | + ); |
|
@@ -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,7 +294,7 @@ 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 | 299 | $days = array( |
| 300 | 300 | 1 => 'Shanbe', |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | $day = $date_time->format('l'); |
| 313 | 313 | |
| 314 | 314 | $day = str_replace( |
| 315 | - $configGregorian[ 'days_of_week' ], |
|
| 316 | - $configShamsi[ 'days_of_week' ], |
|
| 315 | + $configGregorian['days_of_week'], |
|
| 316 | + $configShamsi['days_of_week'], |
|
| 317 | 317 | $day |
| 318 | 318 | ); |
| 319 | 319 | |
@@ -333,26 +333,26 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | *\_________________________________________________________/ |
| 335 | 335 | */ |
| 336 | - 'leap_year' => function ($year) { |
|
| 336 | + 'leap_year' => function($year) { |
|
| 337 | 337 | |
| 338 | 338 | $a = 0.025; |
| 339 | 339 | |
| 340 | 340 | $b = 266; |
| 341 | 341 | |
| 342 | 342 | if ($year > 0) { |
| 343 | - $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; |
|
| 343 | + $leapDays0 = (($year + 38) % 2820) * 0.24219 + $a; |
|
| 344 | 344 | // 0.24219 ~ extra days of one year |
| 345 | - $leapDays1 = (($year + 39) % 2820)*0.24219 + $a; |
|
| 345 | + $leapDays1 = (($year + 39) % 2820) * 0.24219 + $a; |
|
| 346 | 346 | // 38 days is the difference of epoch to 2820-year cycle |
| 347 | 347 | } elseif ($year < 0) { |
| 348 | - $leapDays0 = (($year + 39) % 2820)*0.24219 + $a; |
|
| 349 | - $leapDays1 = (($year + 40) % 2820)*0.24219 + $a; |
|
| 348 | + $leapDays0 = (($year + 39) % 2820) * 0.24219 + $a; |
|
| 349 | + $leapDays1 = (($year + 40) % 2820) * 0.24219 + $a; |
|
| 350 | 350 | } else { |
| 351 | 351 | return false; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
| 355 | - $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
| 354 | + $frac0 = intval(($leapDays0 - intval($leapDays0)) * 1000); |
|
| 355 | + $frac1 = intval(($leapDays1 - intval($leapDays1)) * 1000); |
|
| 356 | 356 | |
| 357 | 357 | if ($frac0 <= $b && $frac1 > $b) { |
| 358 | 358 | return true; |
@@ -370,6 +370,6 @@ discard block |
||
| 370 | 370 | * |
| 371 | 371 | *\_________________________________________________________/ |
| 372 | 372 | */ |
| 373 | - 'weekend' => array( 'friday' ) |
|
| 373 | + 'weekend' => array('friday') |
|
| 374 | 374 | |
| 375 | 375 | ); |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | 'default_calendar' => 'gregorian', |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - 'date_interval' => [ 'D', 'M', 'Y', 'HT', 'MT', 'ST' ], |
|
| 23 | + 'date_interval' => ['D', 'M', 'Y', 'HT', 'MT', 'ST'], |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - 'date_simple' => [ 'day', ' month', ' year', ' hour', ' minute', ' second' ], |
|
| 26 | + 'date_simple' => ['day', ' month', ' year', ' hour', ' minute', ' second'], |
|
| 27 | 27 | |
| 28 | 28 | ]; |