| @@ -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 | } | 
| @@ -49,12 +49,12 @@ | ||
| 49 | 49 | /** | 
| 50 | 50 | * Fetch translated expression to langTable attribute | 
| 51 | 51 | */ | 
| 52 | - self::$langTable = include 'lang/' . $language . '/general.php'; | |
| 52 | + self::$langTable = include '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 | } | 
| @@ -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 | |
| @@ -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 | |
| @@ -179,6 +179,6 @@ discard block | ||
| 179 | 179 | * | 
| 180 | 180 | *\_________________________________________________________/ | 
| 181 | 181 | */ | 
| 182 | - 'weekend' => array( 'saturday', 'sunday' ), | |
| 182 | +    'weekend' => array('saturday', 'sunday'), | |
| 183 | 183 | |
| 184 | 184 | ]; | 
| @@ -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,9 +294,9 @@ 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 | - $days = array( 1 => 'Shanbe', 2 => 'Yekshanbe', 3 => 'Doshanbe', 4 => 'Seshanbe', 5 => 'Chaharshanbe', 6 => 'Panjshanbe', 7 => 'Jome' ); | |
| 299 | + $days = array(1 => 'Shanbe', 2 => 'Yekshanbe', 3 => 'Doshanbe', 4 => 'Seshanbe', 5 => 'Chaharshanbe', 6 => 'Panjshanbe', 7 => 'Jome'); | |
| 300 | 300 | |
| 301 | 301 | $configShamsi = include 'Jalali.php'; | 
| 302 | 302 | |
| @@ -304,7 +304,7 @@ discard block | ||
| 304 | 304 | |
| 305 | 305 |          $day = $date_time->format('l'); | 
| 306 | 306 | |
| 307 | - $day = str_replace($configGregorian[ 'days_of_week' ], $configShamsi[ 'days_of_week' ], $day); | |
| 307 | + $day = str_replace($configGregorian['days_of_week'], $configShamsi['days_of_week'], $day); | |
| 308 | 308 | |
| 309 | 309 |      foreach ($days as $key => $value) { | 
| 310 | 310 |          if ($day == $value) { | 
| @@ -332,6 +332,6 @@ discard block | ||
| 332 | 332 | * | 
| 333 | 333 | *\_________________________________________________________/ | 
| 334 | 334 | */ | 
| 335 | - 'weekend' => array( 'friday' ) | |
| 335 | +  'weekend' => array('friday') | |
| 336 | 336 | |
| 337 | 337 | ); | 
| @@ -3,9 +3,9 @@ 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 | 
| 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 | 
| @@ -192,7 +192,7 @@ discard block | ||
| 192 | 192 | |
| 193 | 193 | 'Dhu al_Hijjah' | 
| 194 | 194 | |
| 195 | - ), | |
| 195 | + ), | |
| 196 | 196 | |
| 197 | 197 | /************************************************************ | 
| 198 | 198 | * Days of Week | 
| @@ -204,13 +204,13 @@ discard block | ||
| 204 | 204 | *\_________________________________________________________/ | 
| 205 | 205 | */ | 
| 206 | 206 | 'days_of_week' => array ( | 
| 207 | - 'al-Aḥad', | |
| 208 | - 'al-Ithnayn', | |
| 209 | - 'ath-Thulatha\'', | |
| 210 | - 'al-Arbi\'a', | |
| 211 | - 'al-Khamees', | |
| 212 | - 'al-Jumu\'ah', | |
| 213 | - 'as-Sabt', | |
| 207 | + 'al-Aḥad', | |
| 208 | + 'al-Ithnayn', | |
| 209 | + 'ath-Thulatha\'', | |
| 210 | + 'al-Arbi\'a', | |
| 211 | + 'al-Khamees', | |
| 212 | + 'al-Jumu\'ah', | |
| 213 | + 'as-Sabt', | |
| 214 | 214 | |
| 215 | 215 | ), | 
| 216 | 216 | |
| @@ -226,17 +226,17 @@ discard block | ||
| 226 | 226 | |
| 227 | 227 | |
| 228 | 228 | 'month_days_number' => array( 1 => 30, | 
| 229 | - 2 => 29, | |
| 230 | - 3 => 30, | |
| 231 | - 4 => 30, | |
| 232 | - 5 => 29, | |
| 233 | - 6 => 29, | |
| 234 | - 7 => 30, | |
| 235 | - 8 => 29, | |
| 236 | - 9 => 30, | |
| 237 | - 10 => 29, | |
| 238 | - 11 => 30, | |
| 239 | - 12 => 30 ), | |
| 229 | + 2 => 29, | |
| 230 | + 3 => 30, | |
| 231 | + 4 => 30, | |
| 232 | + 5 => 29, | |
| 233 | + 6 => 29, | |
| 234 | + 7 => 30, | |
| 235 | + 8 => 29, | |
| 236 | + 9 => 30, | |
| 237 | + 10 => 29, | |
| 238 | + 11 => 30, | |
| 239 | + 12 => 30 ), | |
| 240 | 240 | /************************************************************ | 
| 241 | 241 | * Day of year | 
| 242 | 242 | ************************************************************ | 
| @@ -245,7 +245,7 @@ discard block | ||
| 245 | 245 | * | 
| 246 | 246 | *\_________________________________________________________/ | 
| 247 | 247 | */ | 
| 248 | -     'day_of_year' => function ($date_time) { | |
| 248 | +      'day_of_year' => function ($date_time) { | |
| 249 | 249 | |
| 250 | 250 | $result = null; | 
| 251 | 251 | |
| @@ -265,9 +265,9 @@ discard block | ||
| 265 | 265 | |
| 266 | 266 | return $result; | 
| 267 | 267 | |
| 268 | - }, | |
| 268 | + }, | |
| 269 | 269 | |
| 270 | - /************************************************************ | |
| 270 | + /************************************************************ | |
| 271 | 271 | * Day of week | 
| 272 | 272 | ************************************************************ | 
| 273 | 273 | * | 
| @@ -275,7 +275,7 @@ discard block | ||
| 275 | 275 | * example : al-Aḥad = result is 1 | 
| 276 | 276 | *\_________________________________________________________/ | 
| 277 | 277 | */ | 
| 278 | -     'day_of_week' => function ($date_time) { | |
| 278 | +      'day_of_week' => function ($date_time) { | |
| 279 | 279 | |
| 280 | 280 | $configGhamari = include 'Hijri.php'; | 
| 281 | 281 | |
| @@ -291,9 +291,9 @@ discard block | ||
| 291 | 291 | } | 
| 292 | 292 | } | 
| 293 | 293 | |
| 294 | - }, | |
| 294 | + }, | |
| 295 | 295 | |
| 296 | - /************************************************************ | |
| 296 | + /************************************************************ | |
| 297 | 297 | * Leap year | 
| 298 | 298 | ************************************************************ | 
| 299 | 299 | * | 
| @@ -301,7 +301,7 @@ discard block | ||
| 301 | 301 | * | 
| 302 | 302 | *\_________________________________________________________/ | 
| 303 | 303 | */ | 
| 304 | - 'leap_year' => null, | |
| 304 | + 'leap_year' => null, | |
| 305 | 305 | |
| 306 | 306 | /************************************************************ | 
| 307 | 307 | * 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 | |
| @@ -115,21 +115,21 @@ discard block | ||
| 115 | 115 | |
| 116 | 116 | $days_of_year += $day; | 
| 117 | 117 | |
| 118 | - $days_of_leap_years = intval(( ( $year - 1 ) / 3 )); | |
| 118 | + $days_of_leap_years = intval((($year - 1) / 3)); | |
| 119 | 119 | |
| 120 | - $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years ); | |
| 120 | + $days_of_ghamari_years = ((($year - 1) * 354) + $days_of_year + $days_of_leap_years); | |
| 121 | 121 | |
| 122 | 122 | $days_of_gregorain_years = $days_of_ghamari_years + 227078; | 
| 123 | 123 | |
| 124 | - $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 578 ) / 4 )); | |
| 124 | + $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 578) / 4)); | |
| 125 | 125 | |
| 126 | - $gregorian_month = ( $days_of_gregorain_years % 365 ); | |
| 126 | + $gregorian_month = ($days_of_gregorain_years % 365); | |
| 127 | 127 | |
| 128 | 128 | $gregorian_year = intval($days_of_gregorain_years / 365) + 1; | 
| 129 | 129 | |
| 130 | 130 | $config = include 'Gregorian.php'; | 
| 131 | 131 | |
| 132 | -        foreach ($config [ 'month_days_number' ] as $month => $value) { | |
| 132 | +        foreach ($config ['month_days_number'] as $month => $value) { | |
| 133 | 133 |              if ($gregorian_month < $value) { | 
| 134 | 134 | break; | 
| 135 | 135 | } | 
| @@ -166,7 +166,7 @@ discard block | ||
| 166 | 166 | * | 
| 167 | 167 | *\_________________________________________________________/ | 
| 168 | 168 | */ | 
| 169 | - 'month' => array ( | |
| 169 | + 'month' => array( | |
| 170 | 170 | |
| 171 | 171 | 'Muharram', | 
| 172 | 172 | |
| @@ -203,7 +203,7 @@ discard block | ||
| 203 | 203 | * | 
| 204 | 204 | *\_________________________________________________________/ | 
| 205 | 205 | */ | 
| 206 | - 'days_of_week' => array ( | |
| 206 | + 'days_of_week' => array( | |
| 207 | 207 | 'al-Aḥad', | 
| 208 | 208 | 'al-Ithnayn', | 
| 209 | 209 | 'ath-Thulatha\'', | 
| @@ -214,18 +214,18 @@ discard block | ||
| 214 | 214 | |
| 215 | 215 | ), | 
| 216 | 216 | |
| 217 | - 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), | |
| 217 | +    'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'), | |
| 218 | 218 | |
| 219 | 219 | 'am_time' => 'AM', | 
| 220 | 220 | |
| 221 | 221 | 'pm_time' => 'PM', | 
| 222 | 222 | |
| 223 | - 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ), | |
| 223 | +    'end_of_days' => array('th', 'st', 'nd', 'rd'), | |
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | |
| 228 | - 'month_days_number' => array( 1 => 30, | |
| 228 | + 'month_days_number' => array(1 => 30, | |
| 229 | 229 | 2 => 29, | 
| 230 | 230 | 3 => 30, | 
| 231 | 231 | 4 => 30, | 
| @@ -236,7 +236,7 @@ discard block | ||
| 236 | 236 | 9 => 30, | 
| 237 | 237 | 10 => 29, | 
| 238 | 238 | 11 => 30, | 
| 239 | - 12 => 30 ), | |
| 239 | + 12 => 30), | |
| 240 | 240 | /************************************************************ | 
| 241 | 241 | * Day of year | 
| 242 | 242 | ************************************************************ | 
| @@ -245,7 +245,7 @@ discard block | ||
| 245 | 245 | * | 
| 246 | 246 | *\_________________________________________________________/ | 
| 247 | 247 | */ | 
| 248 | -     'day_of_year' => function ($date_time) { | |
| 248 | +     'day_of_year' => function($date_time) { | |
| 249 | 249 | |
| 250 | 250 | $result = null; | 
| 251 | 251 | |
| @@ -275,7 +275,7 @@ discard block | ||
| 275 | 275 | * example : al-Aḥad = result is 1 | 
| 276 | 276 | *\_________________________________________________________/ | 
| 277 | 277 | */ | 
| 278 | -     'day_of_week' => function ($date_time) { | |
| 278 | +     'day_of_week' => function($date_time) { | |
| 279 | 279 | |
| 280 | 280 | $configGhamari = include 'Hijri.php'; | 
| 281 | 281 | |
| @@ -311,6 +311,6 @@ discard block | ||
| 311 | 311 | * | 
| 312 | 312 | *\_________________________________________________________/ | 
| 313 | 313 | */ | 
| 314 | - 'weekend' => array( 'friday', 'saturday' ), | |
| 314 | +    'weekend' => array('friday', 'saturday'), | |
| 315 | 315 | |
| 316 | 316 | ); | 
| @@ -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 | } | 
| @@ -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 | $jalali_years += 128; | 
| 66 | 66 | } | 
| 67 | 67 | |
| @@ -74,7 +74,7 @@ discard block | ||
| 74 | 74 | $this->result = $this->result % 33; | 
| 75 | 75 | } | 
| 76 | 76 | |
| 77 | -        if (( $this->result == 28 ) || ( $this->result == 27 )) { | |
| 77 | +        if (($this->result == 28) || ($this->result == 27)) { | |
| 78 | 78 | return $this->result; | 
| 79 | 79 | } | 
| 80 | 80 | |
| @@ -87,7 +87,7 @@ discard block | ||
| 87 | 87 | $this->result = $this->result % 33; | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | -        if (( ( $this->result % 4 ) == 0 ) && ( $this->result != 28 )) { | |
| 90 | +        if ((($this->result % 4) == 0) && ($this->result != 28)) { | |
| 91 | 91 | return $this->result; | 
| 92 | 92 | } | 
| 93 | 93 | } | 
| @@ -103,7 +103,7 @@ discard block | ||
| 103 | 103 | |
| 104 | 104 | $this->result = $this->year % 30; | 
| 105 | 105 | |
| 106 | -        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 )) { | |
| 106 | +        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)) { | |
| 107 | 107 | return $this->result; | 
| 108 | 108 | } | 
| 109 | 109 | |
| @@ -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 | } |