@@ -100,7 +100,7 @@ |
||
| 100 | 100 | /** |
| 101 | 101 | * check the ghamari year is leap or not |
| 102 | 102 | * @since Oct, 24 2015 |
| 103 | - * @return boolean |
|
| 103 | + * @return integer|null |
|
| 104 | 104 | */ |
| 105 | 105 | public function ghamariLeapYear() { |
| 106 | 106 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param $year integer |
| 27 | 27 | * @since Aug, 21 2015 |
| 28 | 28 | */ |
| 29 | - public function __construct( $year, $type = 'gregorian' ) |
|
| 29 | + public function __construct($year, $type = 'gregorian') |
|
| 30 | 30 | { |
| 31 | 31 | |
| 32 | 32 | $this->year = $year; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function gregorinLeapYear() |
| 47 | 47 | { |
| 48 | 48 | |
| 49 | - return ( ( ( $this->year % 4 ) == 0 ) && ( ( ( $this->year % 100 ) != 0 ) || ( ( $this->year % 400 ) == 0 ) ) ); |
|
| 49 | + return ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0))); |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $jalali_years = 0; |
| 63 | 63 | |
| 64 | - while ( $jalali_years < ( $this->year - 128 ) ) { |
|
| 64 | + while ($jalali_years < ($this->year - 128)) { |
|
| 65 | 65 | |
| 66 | 66 | $jalali_years += 128; |
| 67 | 67 | |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $this->result -= $jalali_years; |
| 74 | 74 | |
| 75 | - if ($this->result >= 33 ) { |
|
| 75 | + if ($this->result >= 33) { |
|
| 76 | 76 | |
| 77 | 77 | $this->result = $this->result % 33; |
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (( $this->result == 28 ) || ( $this->result == 27 ) ) { |
|
| 81 | + if (($this->result == 28) || ($this->result == 27)) { |
|
| 82 | 82 | |
| 83 | 83 | return $this->result; |
| 84 | 84 | |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $this->result -= $jalali_years; |
| 91 | 91 | |
| 92 | - if ($this->result >= 33 ) { |
|
| 92 | + if ($this->result >= 33) { |
|
| 93 | 93 | |
| 94 | 94 | $this->result = $this->result % 33; |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (( ( $this->result % 4 ) == 0 ) && ( $this->result != 28 ) ) { |
|
| 98 | + if ((($this->result % 4) == 0) && ($this->result != 28)) { |
|
| 99 | 99 | |
| 100 | 100 | return $this->result; |
| 101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $this->result = $this->year % 30; |
| 115 | 115 | |
| 116 | - if (( 2 == $this->result ) || ( 5 == $this->result ) || ( 7 == $this->result ) || ( 10 == $this->result ) || ( 13 == $this->result ) || ( 16 == $this->result ) || ( 18 == $this->result ) || ( 21 == $this->result ) || ( 24 == $this->year ) || ( 26 == $this->result ) || ( 29 == $this->result ) ) { |
|
| 116 | + if ((2 == $this->result) || (5 == $this->result) || (7 == $this->result) || (10 == $this->result) || (13 == $this->result) || (16 == $this->result) || (18 == $this->result) || (21 == $this->result) || (24 == $this->year) || (26 == $this->result) || (29 == $this->result)) { |
|
| 117 | 117 | |
| 118 | 118 | return $this->result; |
| 119 | 119 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function get() |
| 131 | 131 | { |
| 132 | 132 | |
| 133 | - switch ( $this->type ) { |
|
| 133 | + switch ($this->type) { |
|
| 134 | 134 | |
| 135 | 135 | case 'gregorian': |
| 136 | 136 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * @link http://www.un.org/en/sections/observances/international-days/ |
| 14 | 14 | */ |
| 15 | 15 | 'events' => array( |
| 16 | - 1 => array( 27 => 'International Day of Commemoration in Memory of the Victims of the Holocaust' ), |
|
| 16 | + 1 => array(27 => 'International Day of Commemoration in Memory of the Victims of the Holocaust'), |
|
| 17 | 17 | 2 => array( |
| 18 | 18 | 4 => 'World Cancer Day', |
| 19 | 19 | 6 => 'International Day of Zero Tolerance to Female Genital Mutilation', |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | * as a arraye value |
| 13 | 13 | */ |
| 14 | 14 | 'events' => array( |
| 15 | - 1 => array( 1 => 'nowruz', 2 => 'nowruz', 3 => 'nowruz', 5 => 'nowruz' ), |
|
| 16 | - 10 => array( 22 => 'Iran revelution day' ), |
|
| 17 | - 12 => array( 29 => 'Iran oil national day' ) |
|
| 15 | + 1 => array(1 => 'nowruz', 2 => 'nowruz', 3 => 'nowruz', 5 => 'nowruz'), |
|
| 16 | + 10 => array(22 => 'Iran revelution day'), |
|
| 17 | + 12 => array(29 => 'Iran oil national day') |
|
| 18 | 18 | ), |
| 19 | 19 | |
| 20 | 20 | ); |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | |
| 10 | 10 | 'events' => array( |
| 11 | 11 | |
| 12 | - 4 => array( 22 => 'Earth day' ), |
|
| 12 | + 4 => array(22 => 'Earth day'), |
|
| 13 | 13 | |
| 14 | - 12 => array( 25 => 'Christmas' ) |
|
| 14 | + 12 => array(25 => 'Christmas') |
|
| 15 | 15 | |
| 16 | 16 | ) |
| 17 | 17 | |
@@ -35,9 +35,9 @@ |
||
| 35 | 35 | 'default_calendar' => 'gregorian', |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - 'date_interval' => array( 'D', 'M', 'Y', 'H', 'm', 'S' ), |
|
| 38 | + 'date_interval' => array('D', 'M', 'Y', 'H', 'm', 'S'), |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - 'date_simple' => array( 'day', ' month', ' year', ' hour', ' minute', ' second' ), |
|
| 41 | + 'date_simple' => array('day', ' month', ' year', ' hour', ' minute', ' second'), |
|
| 42 | 42 | |
| 43 | 43 | ); |
@@ -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 | |
@@ -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' => '۲', |
@@ -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 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
| 66 | 66 | */ |
| 67 | - public function __construct( $date_time = null ) |
|
| 67 | + public function __construct($date_time = null) |
|
| 68 | 68 | { |
| 69 | 69 | |
| 70 | - if ($date_time !== null ) { |
|
| 70 | + if ($date_time !== null) { |
|
| 71 | 71 | |
| 72 | 72 | $this->date_time = $date_time; |
| 73 | 73 | |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function from( $calendar ) |
|
| 80 | + public function from($calendar) |
|
| 81 | 81 | { |
| 82 | 82 | |
| 83 | - $this->calendar_file = include 'CalendarSettings/' . ucfirst($calendar) . '.php'; |
|
| 83 | + $this->calendar_file = include 'CalendarSettings/'.ucfirst($calendar).'.php'; |
|
| 84 | 84 | |
| 85 | - return $this->calendar_file[ 'convert_from' ]( $this->date_time ); |
|
| 85 | + return $this->calendar_file['convert_from']($this->date_time); |
|
| 86 | 86 | |
| 87 | 87 | } |
| 88 | 88 | |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ |
| 96 | 96 | */ |
| 97 | - public function to( $calendar ) |
|
| 97 | + public function to($calendar) |
|
| 98 | 98 | { |
| 99 | 99 | |
| 100 | - $this->calendar_file = include 'CalendarSettings/' . ucfirst($calendar) . '.php'; |
|
| 100 | + $this->calendar_file = include 'CalendarSettings/'.ucfirst($calendar).'.php'; |
|
| 101 | 101 | |
| 102 | - return $this->calendar_file[ 'convert_to' ]( $this->date_time ); |
|
| 102 | + return $this->calendar_file['convert_to']($this->date_time); |
|
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @since Oct, 16 2015 |
| 110 | 110 | * @return object |
| 111 | 111 | */ |
| 112 | - public function jalaliToGregorian( $date_time ) |
|
| 112 | + public function jalaliToGregorian($date_time) |
|
| 113 | 113 | { |
| 114 | 114 | |
| 115 | 115 | $this->config = include 'Jalali.php'; |
@@ -124,42 +124,42 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $days_of_year = 0; |
| 126 | 126 | |
| 127 | - foreach ( $this->config[ 'month_days_number' ] as $month => $value ) { |
|
| 127 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 128 | 128 | |
| 129 | - if ($this->month > $month ) { $days_of_year += $value; |
|
| 129 | + if ($this->month > $month) { $days_of_year += $value; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $days_of_year += $this->day; |
| 135 | 135 | |
| 136 | - $days_of_leap_years = intval(( ( $this->year - 1 ) / 4 )); |
|
| 136 | + $days_of_leap_years = intval((($this->year - 1) / 4)); |
|
| 137 | 137 | |
| 138 | - $days_of_jalali_years = ( ( ( $this->year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years ); |
|
| 138 | + $days_of_jalali_years = ((($this->year - 1) * 365) + $days_of_year + $days_of_leap_years); |
|
| 139 | 139 | |
| 140 | 140 | $days_of_gregorain_years = $days_of_jalali_years + 226899; |
| 141 | 141 | |
| 142 | - if ($this->month < 10 ) { |
|
| 142 | + if ($this->month < 10) { |
|
| 143 | 143 | |
| 144 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 621 ) / 4 )); |
|
| 144 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 621) / 4)); |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - elseif (( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 148 | + elseif (((10 == $this->month) && ($this->day > 10)) || ($this->month > 10)) { |
|
| 149 | 149 | |
| 150 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 622 ) / 4 )); |
|
| 150 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 622) / 4)); |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
| 154 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
| 155 | 155 | |
| 156 | 156 | $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
| 157 | 157 | |
| 158 | 158 | $this->config = include 'Gregorian.php'; |
| 159 | 159 | |
| 160 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 160 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 161 | 161 | |
| 162 | - if ($gregorian_month < $value ) { break; |
|
| 162 | + if ($gregorian_month < $value) { break; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $gregorian_month -= $value; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @since Oct, 17 2015 |
| 183 | 183 | * @return object |
| 184 | 184 | */ |
| 185 | - public function jalaliToHijri( $date_time ) |
|
| 185 | + public function jalaliToHijri($date_time) |
|
| 186 | 186 | { |
| 187 | 187 | |
| 188 | 188 | $this->date_time = $date_time; |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | $this->day = $this->date_time->format('d'); |
| 195 | 195 | |
| 196 | - $this->temp_day = 0 ; |
|
| 196 | + $this->temp_day = 0; |
|
| 197 | 197 | |
| 198 | 198 | $this->config = include 'Jalali.php'; |
| 199 | 199 | |
| 200 | - for ( $i = 1 ; $i < $this->month ; $i++ ) { |
|
| 200 | + for ($i = 1; $i < $this->month; $i++) { |
|
| 201 | 201 | |
| 202 | 202 | $this->temp_day += $this->config['month_days_number'][$i]; |
| 203 | 203 | |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $this->leap = new Leap($this->year); |
| 209 | 209 | |
| 210 | - if ($this->leap->get() && $this->month > 11 ) { $this->temp_day++; |
|
| 210 | + if ($this->leap->get() && $this->month > 11) { $this->temp_day++; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
|
| 213 | + $_year = ((((($this->year - 1) * 365.2422) + $this->temp_day) - 119) / 354.3670) + 1; |
|
| 214 | 214 | |
| 215 | 215 | $_year = explode('.', $_year); |
| 216 | 216 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | $var_temp = '0.0'; |
| 222 | 222 | |
| 223 | - for ( $i = strlen($_month); $i > 2; $i-- ) { |
|
| 223 | + for ($i = strlen($_month); $i > 2; $i--) { |
|
| 224 | 224 | |
| 225 | 225 | $var_temp .= '0'; |
| 226 | 226 | |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | $var_temp .= '1'; |
| 230 | 230 | |
| 231 | - $_month = $_month * $var_temp ; |
|
| 231 | + $_month = $_month * $var_temp; |
|
| 232 | 232 | |
| 233 | - $_month = ( $_month * 12 ) + 1; |
|
| 233 | + $_month = ($_month * 12) + 1; |
|
| 234 | 234 | |
| 235 | 235 | $_month = explode('.', $_month); |
| 236 | 236 | |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | $var_temp = '0.0'; |
| 242 | 242 | |
| 243 | - for ( $i = strlen($_day); $i > 2; $i-- ) { |
|
| 243 | + for ($i = strlen($_day); $i > 2; $i--) { |
|
| 244 | 244 | |
| 245 | - $var_temp .= '0' ; |
|
| 245 | + $var_temp .= '0'; |
|
| 246 | 246 | |
| 247 | 247 | } |
| 248 | 248 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | $_day = $_day * $var_temp; |
| 252 | 252 | |
| 253 | - $_day = ( $_day * 29.530 ); |
|
| 253 | + $_day = ($_day * 29.530); |
|
| 254 | 254 | |
| 255 | 255 | $_day = explode('.', $_day); |
| 256 | 256 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @since Oct, 17 2015 |
| 269 | 269 | * @return object |
| 270 | 270 | */ |
| 271 | - public function hijriToJalali( $date_time ) |
|
| 271 | + public function hijriToJalali($date_time) |
|
| 272 | 272 | { |
| 273 | 273 | |
| 274 | 274 | $this->date_time = $date_time; |
@@ -283,32 +283,32 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | $this->config = include 'Hijri.php'; |
| 285 | 285 | |
| 286 | - foreach ( $this->config[ 'month_days_number' ] as $month => $value ) { |
|
| 286 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 287 | 287 | |
| 288 | - if ($this->month > $month ) { $days_of_year += $value; |
|
| 288 | + if ($this->month > $month) { $days_of_year += $value; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | $days_of_year += $this->day; |
| 294 | 294 | |
| 295 | - $days_of_leap_years = intval(( ( $this->year - 1 ) / 3 )); |
|
| 295 | + $days_of_leap_years = intval((($this->year - 1) / 3)); |
|
| 296 | 296 | |
| 297 | - $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
| 297 | + $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
| 298 | 298 | |
| 299 | 299 | $days_of_jalali_years = $days_of_hijri_years + 179; |
| 300 | 300 | |
| 301 | - $days_of_jalali_years = $days_of_jalali_years - intval(( ( $this->year - 43 ) / 4 )); |
|
| 301 | + $days_of_jalali_years = $days_of_jalali_years - intval((($this->year - 43) / 4)); |
|
| 302 | 302 | |
| 303 | - $jalali_month = ( $days_of_jalali_years % 365 ); |
|
| 303 | + $jalali_month = ($days_of_jalali_years % 365); |
|
| 304 | 304 | |
| 305 | 305 | $jalali_year = intval($days_of_jalali_years / 365) + 1; |
| 306 | 306 | |
| 307 | 307 | $this->config = include 'Jalali.php'; |
| 308 | 308 | |
| 309 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 309 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 310 | 310 | |
| 311 | - if ($jalali_month < $value ) { break; |
|
| 311 | + if ($jalali_month < $value) { break; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $jalali_month -= $value; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * @since Oct, 17 2015 |
| 331 | 331 | * @return object |
| 332 | 332 | */ |
| 333 | - public function hijriToGregorian( $date_time ) |
|
| 333 | + public function hijriToGregorian($date_time) |
|
| 334 | 334 | { |
| 335 | 335 | |
| 336 | 336 | $this->date_time = $date_time; |
@@ -345,32 +345,32 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | $this->config = include 'Hijri.php'; |
| 347 | 347 | |
| 348 | - foreach ( $this->config[ 'month_days_number' ] as $month => $value ) { |
|
| 348 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 349 | 349 | |
| 350 | - if ($this->month > $month ) { $days_of_year += $value; |
|
| 350 | + if ($this->month > $month) { $days_of_year += $value; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | $days_of_year += $this->day; |
| 356 | 356 | |
| 357 | - $days_of_leap_years = intval(( ( $this->year - 1 ) / 3 )); |
|
| 357 | + $days_of_leap_years = intval((($this->year - 1) / 3)); |
|
| 358 | 358 | |
| 359 | - $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); |
|
| 359 | + $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years); |
|
| 360 | 360 | |
| 361 | 361 | $days_of_gregorain_years = $days_of_hijri_years + 227078; |
| 362 | 362 | |
| 363 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 578 ) / 4 )); |
|
| 363 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 578) / 4)); |
|
| 364 | 364 | |
| 365 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); |
|
| 365 | + $gregorian_month = ($days_of_gregorain_years % 365); |
|
| 366 | 366 | |
| 367 | 367 | $gregorian_year = intval($days_of_gregorain_years / 365) + 1; |
| 368 | 368 | |
| 369 | 369 | $this->config = include 'Gregorian.php'; |
| 370 | 370 | |
| 371 | - foreach ($this->config[ 'month_days_number' ] as $month => $value) { |
|
| 371 | + foreach ($this->config['month_days_number'] as $month => $value) { |
|
| 372 | 372 | |
| 373 | - if ($gregorian_month < $value ) { break; |
|
| 373 | + if ($gregorian_month < $value) { break; |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | $gregorian_month -= $value; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * Get current datetime |
| 184 | 184 | * |
| 185 | 185 | * @since Aug 17 2015 |
| 186 | - * @return object |
|
| 186 | + * @return Datium |
|
| 187 | 187 | */ |
| 188 | 188 | public static function now() |
| 189 | 189 | { |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param integer $minute minute number |
| 205 | 205 | * @param integer $second second number |
| 206 | 206 | * |
| 207 | - * @return object |
|
| 207 | + * @return Datium |
|
| 208 | 208 | */ |
| 209 | 209 | public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) |
| 210 | 210 | { |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @param object $date_start Start of the DateTime |
| 244 | 244 | * @param object $date_end End of the DateTime |
| 245 | 245 | * |
| 246 | - * @return object |
|
| 246 | + * @return Datium |
|
| 247 | 247 | */ |
| 248 | 248 | public static function between( $date_start, $date_end ) |
| 249 | 249 | { |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * |
| 290 | 290 | * @param object $calendar Assigned calendar to when calendar should start. |
| 291 | 291 | * |
| 292 | - * @return object |
|
| 292 | + * @return Datium |
|
| 293 | 293 | */ |
| 294 | 294 | public function to( $calendar ) |
| 295 | 295 | { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * |
| 331 | 331 | * @param string $value How much date should be added to current date |
| 332 | 332 | * |
| 333 | - * @return object |
|
| 333 | + * @return Datium |
|
| 334 | 334 | */ |
| 335 | 335 | public function add( $value ) |
| 336 | 336 | { |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * |
| 361 | 361 | * @param string $value How much date should increase from current date |
| 362 | 362 | * |
| 363 | - * @return obejct |
|
| 363 | + * @return Datium |
|
| 364 | 364 | */ |
| 365 | 365 | public function sub( $value ) |
| 366 | 366 | { |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | * |
| 391 | 391 | * @param string $type Name of the calendar to caculate leap year |
| 392 | 392 | * |
| 393 | - * @return boolean |
|
| 393 | + * @return Leap |
|
| 394 | 394 | */ |
| 395 | 395 | public function leap( $type = 'gregorian' ) |
| 396 | 396 | { |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * |
| 407 | 407 | * @since Aug, 22 2015 |
| 408 | 408 | * |
| 409 | - * @return integer |
|
| 409 | + * @return DayOf |
|
| 410 | 410 | */ |
| 411 | 411 | public function dayOf() |
| 412 | 412 | { |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @param string $language language short name fa, en, ar ... |
| 455 | 455 | * |
| 456 | - * @return object |
|
| 456 | + * @return Datium |
|
| 457 | 457 | */ |
| 458 | 458 | public function lang( $language = 'fa' ) |
| 459 | 459 | { |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $this->config = include 'Config.php'; |
| 107 | 107 | |
| 108 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
| 108 | + $this->calendar_type = $this->config['default_calendar']; |
|
| 109 | 109 | |
| 110 | - date_default_timezone_set($this->config[ 'timezone' ]); |
|
| 110 | + date_default_timezone_set($this->config['timezone']); |
|
| 111 | 111 | |
| 112 | 112 | $this->calendar_type = 'gregorian'; |
| 113 | 113 | |
| 114 | - switch( Datium::$call_type ) { |
|
| 114 | + switch (Datium::$call_type) { |
|
| 115 | 115 | |
| 116 | 116 | case 'now': |
| 117 | 117 | |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | $this->date_time = new DateTime('now'); |
| 127 | 127 | |
| 128 | 128 | $this->date_time->setDate( |
| 129 | - self::$array_date[ 'year' ], |
|
| 130 | - self::$array_date[ 'month' ], |
|
| 131 | - self::$array_date[ 'day' ] |
|
| 129 | + self::$array_date['year'], |
|
| 130 | + self::$array_date['month'], |
|
| 131 | + self::$array_date['day'] |
|
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | 134 | $this->date_time->setTime( |
| 135 | - self::$array_date[ 'hour' ], |
|
| 136 | - self::$array_date[ 'minute' ], |
|
| 137 | - self::$array_date[ 'second' ] |
|
| 135 | + self::$array_date['hour'], |
|
| 136 | + self::$array_date['minute'], |
|
| 137 | + self::$array_date['second'] |
|
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | public function all() |
| 162 | 162 | { |
| 163 | 163 | |
| 164 | - return ( object ) array( |
|
| 164 | + return (object) array( |
|
| 165 | 165 | |
| 166 | 166 | 'second' => $this->date_time->format('s'), |
| 167 | 167 | |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return object |
| 208 | 208 | */ |
| 209 | - public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) |
|
| 209 | + public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) |
|
| 210 | 210 | { |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | 213 | * When we want to set a Datetime object to Datium |
| 214 | 214 | */ |
| 215 | - if(func_num_args() === 1 ) { |
|
| 215 | + if (func_num_args() === 1) { |
|
| 216 | 216 | |
| 217 | 217 | self::$static_date_time = func_get_arg(0); |
| 218 | 218 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @return object |
| 247 | 247 | */ |
| 248 | - public static function between( $date_start, $date_end ) |
|
| 248 | + public static function between($date_start, $date_end) |
|
| 249 | 249 | { |
| 250 | 250 | |
| 251 | 251 | self::$date_start = $date_start; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @return $object |
| 267 | 267 | */ |
| 268 | - public function from( $calendar ) |
|
| 268 | + public function from($calendar) |
|
| 269 | 269 | { |
| 270 | 270 | |
| 271 | 271 | $this->convert = new Convert($this->date_time); |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * |
| 292 | 292 | * @return object |
| 293 | 293 | */ |
| 294 | - public function to( $calendar ) |
|
| 294 | + public function to($calendar) |
|
| 295 | 295 | { |
| 296 | 296 | |
| 297 | 297 | $this->convert = new Convert($this->date_time); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @return object |
| 320 | 320 | */ |
| 321 | - public static function diff( $start, $end ) |
|
| 321 | + public static function diff($start, $end) |
|
| 322 | 322 | { |
| 323 | 323 | |
| 324 | 324 | return date_diff($start, $end); |
@@ -332,19 +332,19 @@ discard block |
||
| 332 | 332 | * |
| 333 | 333 | * @return object |
| 334 | 334 | */ |
| 335 | - public function add( $value ) |
|
| 335 | + public function add($value) |
|
| 336 | 336 | { |
| 337 | 337 | |
| 338 | 338 | $this->date_interval_expression = str_replace( |
| 339 | - $this->config[ 'date_simple' ], |
|
| 340 | - $this->config[ 'date_interval' ], |
|
| 339 | + $this->config['date_simple'], |
|
| 340 | + $this->config['date_interval'], |
|
| 341 | 341 | $value |
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | 344 | $this->date_interval_expression = str_replace( |
| 345 | 345 | ' ', |
| 346 | 346 | '', |
| 347 | - 'P' . $this->date_interval_expression |
|
| 347 | + 'P'.$this->date_interval_expression |
|
| 348 | 348 | ); |
| 349 | 349 | |
| 350 | 350 | $this->date_time->add( |
@@ -362,19 +362,19 @@ discard block |
||
| 362 | 362 | * |
| 363 | 363 | * @return obejct |
| 364 | 364 | */ |
| 365 | - public function sub( $value ) |
|
| 365 | + public function sub($value) |
|
| 366 | 366 | { |
| 367 | 367 | |
| 368 | 368 | $this->date_interval_expression = str_replace( |
| 369 | - $this->config[ 'date_simple' ], |
|
| 370 | - $this->config[ 'date_interval' ], |
|
| 369 | + $this->config['date_simple'], |
|
| 370 | + $this->config['date_interval'], |
|
| 371 | 371 | $value |
| 372 | 372 | ); |
| 373 | 373 | |
| 374 | 374 | $this->date_interval_expression = str_replace( |
| 375 | 375 | ' ', |
| 376 | 376 | '', |
| 377 | - 'P' . $this->date_interval_expression |
|
| 377 | + 'P'.$this->date_interval_expression |
|
| 378 | 378 | ); |
| 379 | 379 | |
| 380 | 380 | $this->date_time->sub( |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | * |
| 393 | 393 | * @return boolean |
| 394 | 394 | */ |
| 395 | - public function leap( $type = 'gregorian' ) |
|
| 395 | + public function leap($type = 'gregorian') |
|
| 396 | 396 | { |
| 397 | 397 | |
| 398 | 398 | $this->leap = new Leap($this->date_time->format('Y'), $type); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * |
| 456 | 456 | * @return object |
| 457 | 457 | */ |
| 458 | - public function lang( $language = 'fa' ) |
|
| 458 | + public function lang($language = 'fa') |
|
| 459 | 459 | { |
| 460 | 460 | |
| 461 | 461 | $this->language = $language; |
@@ -479,65 +479,65 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @return string |
| 481 | 481 | */ |
| 482 | - public function get( $format = 'Y-m-d H:i:s' ) |
|
| 482 | + public function get($format = 'Y-m-d H:i:s') |
|
| 483 | 483 | { |
| 484 | 484 | |
| 485 | 485 | // $this->translate_from_file = include( 'Lang/en/general.php' ); |
| 486 | 486 | // |
| 487 | 487 | // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
| 488 | 488 | |
| 489 | - if (is_null($this->fromConfig) ) { |
|
| 489 | + if (is_null($this->fromConfig)) { |
|
| 490 | 490 | |
| 491 | - $this->fromConfig = include 'CalendarSettings/' . |
|
| 492 | - ucfirst($this->translate_from) . '.php'; |
|
| 491 | + $this->fromConfig = include 'CalendarSettings/'. |
|
| 492 | + ucfirst($this->translate_from).'.php'; |
|
| 493 | 493 | |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
| 497 | - if (is_null($this->toConfig) ) { |
|
| 497 | + if (is_null($this->toConfig)) { |
|
| 498 | 498 | |
| 499 | - $this->toConfig = include 'CalendarSettings/' . |
|
| 500 | - ucfirst($this->translate_to) . '.php'; |
|
| 499 | + $this->toConfig = include 'CalendarSettings/'. |
|
| 500 | + ucfirst($this->translate_to).'.php'; |
|
| 501 | 501 | |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | $string_date = $this->date_time->format($format); |
| 505 | 505 | |
| 506 | - if ($this->translate_to != 'gregorian' ) { |
|
| 506 | + if ($this->translate_to != 'gregorian') { |
|
| 507 | 507 | |
| 508 | 508 | $string_date = str_replace( |
| 509 | - $this->fromConfig[ 'month' ], |
|
| 510 | - $this->toConfig[ 'month' ], |
|
| 509 | + $this->fromConfig['month'], |
|
| 510 | + $this->toConfig['month'], |
|
| 511 | 511 | $string_date |
| 512 | 512 | ); |
| 513 | 513 | |
| 514 | 514 | $string_date = str_replace( |
| 515 | - $this->fromConfig[ 'days_of_week' ], |
|
| 516 | - $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ], |
|
| 515 | + $this->fromConfig['days_of_week'], |
|
| 516 | + $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], |
|
| 517 | 517 | $string_date |
| 518 | 518 | ); |
| 519 | 519 | |
| 520 | 520 | $string_date = str_replace( |
| 521 | - $this->fromConfig[ 'numbers' ], |
|
| 522 | - $this->toConfig[ 'numbers' ], |
|
| 521 | + $this->fromConfig['numbers'], |
|
| 522 | + $this->toConfig['numbers'], |
|
| 523 | 523 | $string_date |
| 524 | 524 | ); |
| 525 | 525 | |
| 526 | 526 | $string_date = str_replace( |
| 527 | - $this->fromConfig[ 'am_time' ], |
|
| 528 | - $this->toConfig[ 'am_time' ], |
|
| 527 | + $this->fromConfig['am_time'], |
|
| 528 | + $this->toConfig['am_time'], |
|
| 529 | 529 | $string_date |
| 530 | 530 | ); |
| 531 | 531 | |
| 532 | 532 | $string_date = str_replace( |
| 533 | - $this->fromConfig[ 'pm_time' ], |
|
| 534 | - $this->toConfig[ 'pm_time' ], |
|
| 533 | + $this->fromConfig['pm_time'], |
|
| 534 | + $this->toConfig['pm_time'], |
|
| 535 | 535 | $string_date |
| 536 | 536 | ); |
| 537 | 537 | |
| 538 | 538 | $string_date = str_replace( |
| 539 | - $this->fromConfig[ 'end_of_days' ], |
|
| 540 | - $this->toConfig[ 'end_of_days' ], |
|
| 539 | + $this->fromConfig['end_of_days'], |
|
| 540 | + $this->toConfig['end_of_days'], |
|
| 541 | 541 | $string_date |
| 542 | 542 | ); |
| 543 | 543 | |