@@ -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 | ); |
@@ -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 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $this->date_time = new DateTime(); |
| 128 | 128 | |
| 129 | - $this->date_time->setTimestamp( self::$timestamp ); |
|
| 129 | + $this->date_time->setTimestamp(self::$timestamp); |
|
| 130 | 130 | |
| 131 | 131 | break; |
| 132 | 132 | |
@@ -141,15 +141,15 @@ discard block |
||
| 141 | 141 | $this->date_time = new DateTime('now'); |
| 142 | 142 | |
| 143 | 143 | $this->date_time->setDate( |
| 144 | - self::$array_date[ 'year' ], |
|
| 145 | - self::$array_date[ 'month' ], |
|
| 146 | - self::$array_date[ 'day' ] |
|
| 144 | + self::$array_date['year'], |
|
| 145 | + self::$array_date['month'], |
|
| 146 | + self::$array_date['day'] |
|
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | 149 | $this->date_time->setTime( |
| 150 | - self::$array_date[ 'hour' ], |
|
| 151 | - self::$array_date[ 'minute' ], |
|
| 152 | - self::$array_date[ 'second' ] |
|
| 150 | + self::$array_date['hour'], |
|
| 151 | + self::$array_date['minute'], |
|
| 152 | + self::$array_date['second'] |
|
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | 155 | break; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | public function all() |
| 175 | 175 | { |
| 176 | 176 | |
| 177 | - return ( object ) array( |
|
| 177 | + return (object) array( |
|
| 178 | 178 | |
| 179 | 179 | 'second' => $this->date_time->format('s'), |
| 180 | 180 | |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | * @param timestamp $timestamp Input timestamp value |
| 260 | 260 | * @return object |
| 261 | 261 | */ |
| 262 | - public static function createTimestamp( $timestamp ) |
|
| 262 | + public static function createTimestamp($timestamp) |
|
| 263 | 263 | { |
| 264 | 264 | |
| 265 | - if( $timestamp != null && is_int( $timestamp ) ) |
|
| 265 | + if ($timestamp != null && is_int($timestamp)) |
|
| 266 | 266 | { |
| 267 | 267 | |
| 268 | 268 | self::$call_type = 'create-timestamp'; |
@@ -392,15 +392,15 @@ discard block |
||
| 392 | 392 | { |
| 393 | 393 | |
| 394 | 394 | $this->date_interval_expression = str_replace( |
| 395 | - $this->config[ 'date_simple' ], |
|
| 396 | - $this->config[ 'date_interval' ], |
|
| 395 | + $this->config['date_simple'], |
|
| 396 | + $this->config['date_interval'], |
|
| 397 | 397 | $value |
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | 400 | $unit = 'P'; |
| 401 | 401 | |
| 402 | 402 | if (strpos($this->date_interval_expression, 'T')) { |
| 403 | - $this->date_interval_expression= str_replace( |
|
| 403 | + $this->date_interval_expression = str_replace( |
|
| 404 | 404 | 'T', |
| 405 | 405 | '', |
| 406 | 406 | $this->date_interval_expression |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $this->date_interval_expression = str_replace( |
| 413 | 413 | ' ', |
| 414 | 414 | '', |
| 415 | - $unit . $this->date_interval_expression |
|
| 415 | + $unit.$this->date_interval_expression |
|
| 416 | 416 | ); |
| 417 | 417 | |
| 418 | 418 | $this->date_time->add( |
@@ -434,15 +434,15 @@ discard block |
||
| 434 | 434 | { |
| 435 | 435 | |
| 436 | 436 | $this->date_interval_expression = str_replace( |
| 437 | - $this->config[ 'date_simple' ], |
|
| 438 | - $this->config[ 'date_interval' ], |
|
| 437 | + $this->config['date_simple'], |
|
| 438 | + $this->config['date_interval'], |
|
| 439 | 439 | $value |
| 440 | 440 | ); |
| 441 | 441 | |
| 442 | 442 | $unit = 'P'; |
| 443 | 443 | |
| 444 | 444 | if (strpos($this->date_interval_expression, 'T')) { |
| 445 | - $this->date_interval_expression= str_replace( |
|
| 445 | + $this->date_interval_expression = str_replace( |
|
| 446 | 446 | 'T', |
| 447 | 447 | '', |
| 448 | 448 | $this->date_interval_expression |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $this->date_interval_expression = str_replace( |
| 455 | 455 | ' ', |
| 456 | 456 | '', |
| 457 | - $unit . $this->date_interval_expression |
|
| 457 | + $unit.$this->date_interval_expression |
|
| 458 | 458 | ); |
| 459 | 459 | |
| 460 | 460 | $this->date_time->sub( |
@@ -593,52 +593,52 @@ discard block |
||
| 593 | 593 | // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' ); |
| 594 | 594 | |
| 595 | 595 | if (is_null($this->fromConfig)) { |
| 596 | - $this->fromConfig = include 'CalendarSettings/' . |
|
| 597 | - ucfirst($this->translate_from) . '.php'; |
|
| 596 | + $this->fromConfig = include 'CalendarSettings/'. |
|
| 597 | + ucfirst($this->translate_from).'.php'; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | |
| 601 | 601 | if (is_null($this->toConfig)) { |
| 602 | - $this->toConfig = include 'CalendarSettings/' . |
|
| 603 | - ucfirst($this->translate_to) . '.php'; |
|
| 602 | + $this->toConfig = include 'CalendarSettings/'. |
|
| 603 | + ucfirst($this->translate_to).'.php'; |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | $string_date = $this->date_time->format($format); |
| 607 | 607 | |
| 608 | 608 | if ($this->translate_to != 'gregorian') { |
| 609 | 609 | $string_date = str_replace( |
| 610 | - $this->fromConfig[ 'month' ], |
|
| 611 | - $this->toConfig[ 'month' ], |
|
| 610 | + $this->fromConfig['month'], |
|
| 611 | + $this->toConfig['month'], |
|
| 612 | 612 | $string_date |
| 613 | 613 | ); |
| 614 | 614 | |
| 615 | 615 | $string_date = str_replace( |
| 616 | - $this->fromConfig[ 'days_of_week' ], |
|
| 617 | - $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ], |
|
| 616 | + $this->fromConfig['days_of_week'], |
|
| 617 | + $this->toConfig['days_of_week'][$this->gregorian_DayofWeek], |
|
| 618 | 618 | $string_date |
| 619 | 619 | ); |
| 620 | 620 | |
| 621 | 621 | $string_date = str_replace( |
| 622 | - $this->fromConfig[ 'numbers' ], |
|
| 623 | - $this->toConfig[ 'numbers' ], |
|
| 622 | + $this->fromConfig['numbers'], |
|
| 623 | + $this->toConfig['numbers'], |
|
| 624 | 624 | $string_date |
| 625 | 625 | ); |
| 626 | 626 | |
| 627 | 627 | $string_date = str_replace( |
| 628 | - $this->fromConfig[ 'am_time' ], |
|
| 629 | - $this->toConfig[ 'am_time' ], |
|
| 628 | + $this->fromConfig['am_time'], |
|
| 629 | + $this->toConfig['am_time'], |
|
| 630 | 630 | $string_date |
| 631 | 631 | ); |
| 632 | 632 | |
| 633 | 633 | $string_date = str_replace( |
| 634 | - $this->fromConfig[ 'pm_time' ], |
|
| 635 | - $this->toConfig[ 'pm_time' ], |
|
| 634 | + $this->fromConfig['pm_time'], |
|
| 635 | + $this->toConfig['pm_time'], |
|
| 636 | 636 | $string_date |
| 637 | 637 | ); |
| 638 | 638 | |
| 639 | 639 | $string_date = str_replace( |
| 640 | - $this->fromConfig[ 'end_of_days' ], |
|
| 641 | - $this->toConfig[ 'end_of_days' ], |
|
| 640 | + $this->fromConfig['end_of_days'], |
|
| 641 | + $this->toConfig['end_of_days'], |
|
| 642 | 642 | $string_date |
| 643 | 643 | ); |
| 644 | 644 | } |