@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php namespace Datium; |
| 2 | 2 | |
| 3 | 3 | use Datium\Tools\Convert; |
| 4 | -use Datium\Tools\DayOf; |
|
| 5 | 4 | use DateTime; |
| 6 | 5 | use DateInterval; |
| 7 | 6 | use DatePeriod; |
@@ -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 | |
@@ -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' => '۲', |
@@ -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'), |
@@ -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 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 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 | ]; |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use OpenCafe\Tools\Leap; |
| 19 | 19 | use OpenCafe\Tools\DayOf; |
| 20 | 20 | use OpenCafe\Tools\Lang; |
| 21 | - |
|
| 22 | 21 | use OpenCafe\Datium; |
| 23 | 22 | |
| 24 | 23 | /** |
@@ -105,9 +105,9 @@ 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 | |
@@ -123,15 +123,15 @@ discard block |
||
| 123 | 123 | $this->date_time = new DateTime('now'); |
| 124 | 124 | |
| 125 | 125 | $this->date_time->setDate( |
| 126 | - self::$array_date[ 'year' ], |
|
| 127 | - self::$array_date[ 'month' ], |
|
| 128 | - self::$array_date[ 'day' ] |
|
| 126 | + self::$array_date['year'], |
|
| 127 | + self::$array_date['month'], |
|
| 128 | + self::$array_date['day'] |
|
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | $this->date_time->setTime( |
| 132 | - self::$array_date[ 'hour' ], |
|
| 133 | - self::$array_date[ 'minute' ], |
|
| 134 | - self::$array_date[ 'second' ] |
|
| 132 | + self::$array_date['hour'], |
|
| 133 | + self::$array_date['minute'], |
|
| 134 | + self::$array_date['second'] |
|
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | 137 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function all() |
| 157 | 157 | { |
| 158 | 158 | |
| 159 | - return ( object ) array( |
|
| 159 | + return (object) array( |
|
| 160 | 160 | |
| 161 | 161 | 'second' => $this->date_time->format('s'), |
| 162 | 162 | |
@@ -327,15 +327,15 @@ discard block |
||
| 327 | 327 | { |
| 328 | 328 | |
| 329 | 329 | $this->date_interval_expression = str_replace( |
| 330 | - $this->config[ 'date_simple' ], |
|
| 331 | - $this->config[ 'date_interval' ], |
|
| 330 | + $this->config['date_simple'], |
|
| 331 | + $this->config['date_interval'], |
|
| 332 | 332 | $value |
| 333 | 333 | ); |
| 334 | 334 | |
| 335 | 335 | $this->date_interval_expression = str_replace( |
| 336 | 336 | ' ', |
| 337 | 337 | '', |
| 338 | - 'P' . $this->date_interval_expression |
|
| 338 | + 'P'.$this->date_interval_expression |
|
| 339 | 339 | ); |
| 340 | 340 | |
| 341 | 341 | $this->date_time->add( |
@@ -357,15 +357,15 @@ discard block |
||
| 357 | 357 | { |
| 358 | 358 | |
| 359 | 359 | $this->date_interval_expression = str_replace( |
| 360 | - $this->config[ 'date_simple' ], |
|
| 361 | - $this->config[ 'date_interval' ], |
|
| 360 | + $this->config['date_simple'], |
|
| 361 | + $this->config['date_interval'], |
|
| 362 | 362 | $value |
| 363 | 363 | ); |
| 364 | 364 | |
| 365 | 365 | $this->date_interval_expression = str_replace( |
| 366 | 366 | ' ', |
| 367 | 367 | '', |
| 368 | - 'P' . $this->date_interval_expression |
|
| 368 | + 'P'.$this->date_interval_expression |
|
| 369 | 369 | ); |
| 370 | 370 | |
| 371 | 371 | $this->date_time->sub( |
@@ -478,52 +478,52 @@ discard block |
||
| 478 | 478 | // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
| 479 | 479 | |
| 480 | 480 | if (is_null($this->fromConfig)) { |
| 481 | - $this->fromConfig = include 'CalendarSettings/' . |
|
| 482 | - ucfirst($this->translate_from) . '.php'; |
|
| 481 | + $this->fromConfig = include 'CalendarSettings/'. |
|
| 482 | + ucfirst($this->translate_from).'.php'; |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | |
| 486 | 486 | if (is_null($this->toConfig)) { |
| 487 | - $this->toConfig = include 'CalendarSettings/' . |
|
| 488 | - ucfirst($this->translate_to) . '.php'; |
|
| 487 | + $this->toConfig = include 'CalendarSettings/'. |
|
| 488 | + ucfirst($this->translate_to).'.php'; |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | $string_date = $this->date_time->format($format); |
| 492 | 492 | |
| 493 | 493 | if ($this->translate_to != 'gregorian') { |
| 494 | 494 | $string_date = str_replace( |
| 495 | - $this->fromConfig[ 'month' ], |
|
| 496 | - $this->toConfig[ 'month' ], |
|
| 495 | + $this->fromConfig['month'], |
|
| 496 | + $this->toConfig['month'], |
|
| 497 | 497 | $string_date |
| 498 | 498 | ); |
| 499 | 499 | |
| 500 | 500 | $string_date = str_replace( |
| 501 | - $this->fromConfig[ 'days_of_week' ], |
|
| 502 | - $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ], |
|
| 501 | + $this->fromConfig['days_of_week'], |
|
| 502 | + $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], |
|
| 503 | 503 | $string_date |
| 504 | 504 | ); |
| 505 | 505 | |
| 506 | 506 | $string_date = str_replace( |
| 507 | - $this->fromConfig[ 'numbers' ], |
|
| 508 | - $this->toConfig[ 'numbers' ], |
|
| 507 | + $this->fromConfig['numbers'], |
|
| 508 | + $this->toConfig['numbers'], |
|
| 509 | 509 | $string_date |
| 510 | 510 | ); |
| 511 | 511 | |
| 512 | 512 | $string_date = str_replace( |
| 513 | - $this->fromConfig[ 'am_time' ], |
|
| 514 | - $this->toConfig[ 'am_time' ], |
|
| 513 | + $this->fromConfig['am_time'], |
|
| 514 | + $this->toConfig['am_time'], |
|
| 515 | 515 | $string_date |
| 516 | 516 | ); |
| 517 | 517 | |
| 518 | 518 | $string_date = str_replace( |
| 519 | - $this->fromConfig[ 'pm_time' ], |
|
| 520 | - $this->toConfig[ 'pm_time' ], |
|
| 519 | + $this->fromConfig['pm_time'], |
|
| 520 | + $this->toConfig['pm_time'], |
|
| 521 | 521 | $string_date |
| 522 | 522 | ); |
| 523 | 523 | |
| 524 | 524 | $string_date = str_replace( |
| 525 | - $this->fromConfig[ 'end_of_days' ], |
|
| 526 | - $this->toConfig[ 'end_of_days' ], |
|
| 525 | + $this->fromConfig['end_of_days'], |
|
| 526 | + $this->toConfig['end_of_days'], |
|
| 527 | 527 | $string_date |
| 528 | 528 | ); |
| 529 | 529 | } |