@@ -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 | |
@@ -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 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | public function from($calendar) |
| 79 | 79 | { |
| 80 | 80 | |
| 81 | - $this->calendar_file = include 'CalendarSettings/' . ucfirst($calendar) . '.php'; |
|
| 81 | + $this->calendar_file = include '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 'CalendarSettings/' . ucfirst($calendar) . '.php'; |
|
| 98 | + $this->calendar_file = include '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 '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 '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 '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 '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 '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 '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 | } |
@@ -58,6 +58,10 @@ |
||
| 58 | 58 | * |
| 59 | 59 | *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ |
| 60 | 60 | */ |
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @param string $path |
|
| 64 | + */ |
|
| 61 | 65 | private function fetch( $path ) |
| 62 | 66 | { |
| 63 | 67 | |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $this->period = new DatePeriod(Events::$date_start, $this->interval, Events::$date_end); |
| 65 | 65 | |
| 66 | 66 | foreach ($this->period as $dt) { |
| 67 | - if (isset($this->events[ 'events' ][ intval($dt->format('m')) ][ intval($dt->format('d')) ])) { |
|
| 68 | - $this->result[ $dt->format('Y-m-d') ][] = $this->events[ 'events' ][ intval($dt->format('m')) ][ intval($dt->format('d')) ]; |
|
| 67 | + if (isset($this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))])) { |
|
| 68 | + $this->result[$dt->format('Y-m-d')][] = $this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))]; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | public function get() |
| 84 | 84 | { |
| 85 | 85 | |
| 86 | - if (! empty($this->result)) { |
|
| 86 | + if ( ! empty($this->result)) { |
|
| 87 | 87 | foreach ($this->result as $key => $day) { |
| 88 | - if (! ( $key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d') )) { |
|
| 89 | - unset($this->result[ $key ]); |
|
| 88 | + if ( ! ($key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d'))) { |
|
| 89 | + unset($this->result[$key]); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } else { |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | $country_code = strtolower($country_code = 'ir'); |
| 117 | 117 | |
| 118 | - $this->local = include 'Localization/' . $country_code . '.php'; |
|
| 118 | + $this->local = include 'Localization/'.$country_code.'.php'; |
|
| 119 | 119 | |
| 120 | - foreach ($this->local[ 'events' ] as $month => $events) { |
|
| 120 | + foreach ($this->local['events'] as $month => $events) { |
|
| 121 | 121 | foreach ($events as $day => $event) { |
| 122 | 122 | $this->date_time = new DateTime(); |
| 123 | 123 | |
| 124 | 124 | $this->date_time->setDate(Events::$date_start->format('Y'), $month, $day); |
| 125 | 125 | |
| 126 | - switch ($this->local[ 'default_calendar' ]) { |
|
| 126 | + switch ($this->local['default_calendar']) { |
|
| 127 | 127 | case 'jalali': |
| 128 | 128 | $this->date_time->setDate(1394, $month, $day); |
| 129 | 129 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $this->result[ $this->date_time->format('Y-m-d') ][] = $event; |
|
| 140 | + $this->result[$this->date_time->format('Y-m-d')][] = $event; |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | public function year() |
| 43 | 43 | { |
| 44 | 44 | |
| 45 | - $this->config = include 'CalendarSettings/' . ucfirst($this->calendar_type) . '.php'; |
|
| 45 | + $this->config = include 'CalendarSettings/'.ucfirst($this->calendar_type).'.php'; |
|
| 46 | 46 | |
| 47 | - return $this->config[ 'day_of_year' ]( $this->date_time ); |
|
| 47 | + return $this->config['day_of_year']($this->date_time); |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | public function week() |
| 59 | 59 | { |
| 60 | 60 | |
| 61 | - $this->config = include 'CalendarSettings/' . ucfirst($this->calendar_type) . '.php'; |
|
| 61 | + $this->config = include 'CalendarSettings/'.ucfirst($this->calendar_type).'.php'; |
|
| 62 | 62 | |
| 63 | - return $this->config[ 'day_of_week' ]( $this->date_time ); |
|
| 63 | + return $this->config['day_of_week']($this->date_time); |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * Get current datetime |
| 179 | 179 | * |
| 180 | 180 | * @since Aug 17 2015 |
| 181 | - * @return object |
|
| 181 | + * @return Datium |
|
| 182 | 182 | */ |
| 183 | 183 | public static function now() |
| 184 | 184 | { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @param integer $minute minute number |
| 200 | 200 | * @param integer $second second number |
| 201 | 201 | * |
| 202 | - * @return object |
|
| 202 | + * @return Datium |
|
| 203 | 203 | */ |
| 204 | 204 | public static function create( |
| 205 | 205 | $year = 2000, |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @param object $date_start Start of the DateTime |
| 242 | 242 | * @param object $date_end End of the DateTime |
| 243 | 243 | * |
| 244 | - * @return object |
|
| 244 | + * @return Datium |
|
| 245 | 245 | */ |
| 246 | 246 | public static function between($date_start, $date_end) |
| 247 | 247 | { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param object $calendar Assigned calendar to when calendar should start. |
| 289 | 289 | * |
| 290 | - * @return object |
|
| 290 | + * @return Datium |
|
| 291 | 291 | */ |
| 292 | 292 | public function to($calendar) |
| 293 | 293 | { |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | * |
| 329 | 329 | * @param string $value How much date should be added to current date |
| 330 | 330 | * |
| 331 | - * @return object |
|
| 331 | + * @return Datium |
|
| 332 | 332 | */ |
| 333 | 333 | public function add($value) |
| 334 | 334 | { |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @param string $value How much date should increase from current date |
| 360 | 360 | * |
| 361 | - * @return obejct |
|
| 361 | + * @return Datium |
|
| 362 | 362 | */ |
| 363 | 363 | public function sub($value) |
| 364 | 364 | { |
@@ -386,9 +386,8 @@ discard block |
||
| 386 | 386 | /** |
| 387 | 387 | * Check if current year is leap or not |
| 388 | 388 | * |
| 389 | - * @param string $type Name of the calendar to caculate leap year |
|
| 390 | 389 | * |
| 391 | - * @return boolean |
|
| 390 | + * @return Leap |
|
| 392 | 391 | */ |
| 393 | 392 | public function leap() |
| 394 | 393 | { |
@@ -404,7 +403,7 @@ discard block |
||
| 404 | 403 | * |
| 405 | 404 | * @since Aug, 22 2015 |
| 406 | 405 | * |
| 407 | - * @return integer |
|
| 406 | + * @return DayOf |
|
| 408 | 407 | */ |
| 409 | 408 | public function dayOf() |
| 410 | 409 | { |
@@ -451,7 +450,7 @@ discard block |
||
| 451 | 450 | * |
| 452 | 451 | * @param string $language language short name fa, en, ar ... |
| 453 | 452 | * |
| 454 | - * @return object |
|
| 453 | + * @return Datium |
|
| 455 | 454 | */ |
| 456 | 455 | public function lang($language = 'fa') |
| 457 | 456 | { |
@@ -471,7 +470,7 @@ discard block |
||
| 471 | 470 | /** |
| 472 | 471 | * Return object as timestamp |
| 473 | 472 | * |
| 474 | - * @return timestamp |
|
| 473 | + * @return integer |
|
| 475 | 474 | */ |
| 476 | 475 | public function timestamp() |
| 477 | 476 | { |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $this->config = include 'Config.php'; |
| 115 | 115 | |
| 116 | - $this->calendar_type = $this->config[ 'default_calendar' ]; |
|
| 116 | + $this->calendar_type = $this->config['default_calendar']; |
|
| 117 | 117 | |
| 118 | - date_default_timezone_set($this->config[ 'timezone' ]); |
|
| 118 | + date_default_timezone_set($this->config['timezone']); |
|
| 119 | 119 | |
| 120 | 120 | $this->calendar_type = 'gregorian'; |
| 121 | 121 | |
@@ -131,15 +131,15 @@ discard block |
||
| 131 | 131 | $this->date_time = new DateTime('now'); |
| 132 | 132 | |
| 133 | 133 | $this->date_time->setDate( |
| 134 | - self::$array_date[ 'year' ], |
|
| 135 | - self::$array_date[ 'month' ], |
|
| 136 | - self::$array_date[ 'day' ] |
|
| 134 | + self::$array_date['year'], |
|
| 135 | + self::$array_date['month'], |
|
| 136 | + self::$array_date['day'] |
|
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | 139 | $this->date_time->setTime( |
| 140 | - self::$array_date[ 'hour' ], |
|
| 141 | - self::$array_date[ 'minute' ], |
|
| 142 | - self::$array_date[ 'second' ] |
|
| 140 | + self::$array_date['hour'], |
|
| 141 | + self::$array_date['minute'], |
|
| 142 | + self::$array_date['second'] |
|
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | 145 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | public function all() |
| 165 | 165 | { |
| 166 | 166 | |
| 167 | - return ( object ) array( |
|
| 167 | + return (object) array( |
|
| 168 | 168 | |
| 169 | 169 | 'second' => $this->date_time->format('s'), |
| 170 | 170 | |
@@ -341,16 +341,16 @@ discard block |
||
| 341 | 341 | { |
| 342 | 342 | |
| 343 | 343 | $this->date_interval_expression = str_replace( |
| 344 | - $this->config[ 'date_simple' ], |
|
| 345 | - $this->config[ 'date_interval' ], |
|
| 344 | + $this->config['date_simple'], |
|
| 345 | + $this->config['date_interval'], |
|
| 346 | 346 | $value |
| 347 | 347 | ); |
| 348 | 348 | |
| 349 | 349 | $unit = 'P'; |
| 350 | 350 | |
| 351 | - if( strpos($this->date_interval_expression, 'T') ) { |
|
| 351 | + if (strpos($this->date_interval_expression, 'T')) { |
|
| 352 | 352 | |
| 353 | - $this->date_interval_expression= str_replace( |
|
| 353 | + $this->date_interval_expression = str_replace( |
|
| 354 | 354 | 'T', |
| 355 | 355 | '', |
| 356 | 356 | $this->date_interval_expression |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $this->date_interval_expression = str_replace( |
| 364 | 364 | ' ', |
| 365 | 365 | '', |
| 366 | - $unit . $this->date_interval_expression |
|
| 366 | + $unit.$this->date_interval_expression |
|
| 367 | 367 | ); |
| 368 | 368 | |
| 369 | 369 | $this->date_time->add( |
@@ -385,16 +385,16 @@ discard block |
||
| 385 | 385 | { |
| 386 | 386 | |
| 387 | 387 | $this->date_interval_expression = str_replace( |
| 388 | - $this->config[ 'date_simple' ], |
|
| 389 | - $this->config[ 'date_interval' ], |
|
| 388 | + $this->config['date_simple'], |
|
| 389 | + $this->config['date_interval'], |
|
| 390 | 390 | $value |
| 391 | 391 | ); |
| 392 | 392 | |
| 393 | 393 | $unit = 'P'; |
| 394 | 394 | |
| 395 | - if( strpos($this->date_interval_expression, 'T') ) { |
|
| 395 | + if (strpos($this->date_interval_expression, 'T')) { |
|
| 396 | 396 | |
| 397 | - $this->date_interval_expression= str_replace( |
|
| 397 | + $this->date_interval_expression = str_replace( |
|
| 398 | 398 | 'T', |
| 399 | 399 | '', |
| 400 | 400 | $this->date_interval_expression |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $this->date_interval_expression = str_replace( |
| 408 | 408 | ' ', |
| 409 | 409 | '', |
| 410 | - $unit . $this->date_interval_expression |
|
| 410 | + $unit.$this->date_interval_expression |
|
| 411 | 411 | ); |
| 412 | 412 | |
| 413 | 413 | $this->date_time->sub( |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | public function ago() |
| 443 | 443 | { |
| 444 | 444 | |
| 445 | - $this->ago = new TimeAgo( $this->date_time, $this->language ); |
|
| 445 | + $this->ago = new TimeAgo($this->date_time, $this->language); |
|
| 446 | 446 | |
| 447 | 447 | return $this->ago->get(); |
| 448 | 448 | |
@@ -546,52 +546,52 @@ discard block |
||
| 546 | 546 | // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
| 547 | 547 | |
| 548 | 548 | if (is_null($this->fromConfig)) { |
| 549 | - $this->fromConfig = include 'CalendarSettings/' . |
|
| 550 | - ucfirst($this->translate_from) . '.php'; |
|
| 549 | + $this->fromConfig = include 'CalendarSettings/'. |
|
| 550 | + ucfirst($this->translate_from).'.php'; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | |
| 554 | 554 | if (is_null($this->toConfig)) { |
| 555 | - $this->toConfig = include 'CalendarSettings/' . |
|
| 556 | - ucfirst($this->translate_to) . '.php'; |
|
| 555 | + $this->toConfig = include 'CalendarSettings/'. |
|
| 556 | + ucfirst($this->translate_to).'.php'; |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | $string_date = $this->date_time->format($format); |
| 560 | 560 | |
| 561 | 561 | if ($this->translate_to != 'gregorian') { |
| 562 | 562 | $string_date = str_replace( |
| 563 | - $this->fromConfig[ 'month' ], |
|
| 564 | - $this->toConfig[ 'month' ], |
|
| 563 | + $this->fromConfig['month'], |
|
| 564 | + $this->toConfig['month'], |
|
| 565 | 565 | $string_date |
| 566 | 566 | ); |
| 567 | 567 | |
| 568 | 568 | $string_date = str_replace( |
| 569 | - $this->fromConfig[ 'days_of_week' ], |
|
| 570 | - $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ], |
|
| 569 | + $this->fromConfig['days_of_week'], |
|
| 570 | + $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], |
|
| 571 | 571 | $string_date |
| 572 | 572 | ); |
| 573 | 573 | |
| 574 | 574 | $string_date = str_replace( |
| 575 | - $this->fromConfig[ 'numbers' ], |
|
| 576 | - $this->toConfig[ 'numbers' ], |
|
| 575 | + $this->fromConfig['numbers'], |
|
| 576 | + $this->toConfig['numbers'], |
|
| 577 | 577 | $string_date |
| 578 | 578 | ); |
| 579 | 579 | |
| 580 | 580 | $string_date = str_replace( |
| 581 | - $this->fromConfig[ 'am_time' ], |
|
| 582 | - $this->toConfig[ 'am_time' ], |
|
| 581 | + $this->fromConfig['am_time'], |
|
| 582 | + $this->toConfig['am_time'], |
|
| 583 | 583 | $string_date |
| 584 | 584 | ); |
| 585 | 585 | |
| 586 | 586 | $string_date = str_replace( |
| 587 | - $this->fromConfig[ 'pm_time' ], |
|
| 588 | - $this->toConfig[ 'pm_time' ], |
|
| 587 | + $this->fromConfig['pm_time'], |
|
| 588 | + $this->toConfig['pm_time'], |
|
| 589 | 589 | $string_date |
| 590 | 590 | ); |
| 591 | 591 | |
| 592 | 592 | $string_date = str_replace( |
| 593 | - $this->fromConfig[ 'end_of_days' ], |
|
| 594 | - $this->toConfig[ 'end_of_days' ], |
|
| 593 | + $this->fromConfig['end_of_days'], |
|
| 594 | + $this->toConfig['end_of_days'], |
|
| 595 | 595 | $string_date |
| 596 | 596 | ); |
| 597 | 597 | } |