@@ -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; |
@@ -125,17 +125,19 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $this->leap = new leap( $this->year ); |
| 127 | 127 | |
| 128 | - if( $this->leap->get() && $this->month > 2 ) $this->temp_day++; |
|
| 128 | + if( $this->leap->get() && $this->month > 2 ) { |
|
| 129 | + $this->temp_day++; |
|
| 130 | + } |
|
| 129 | 131 | |
| 130 | 132 | if ( $this->temp_day <= 79 ) { |
| 131 | 133 | |
| 132 | - if( ( $this->year - 1 ) % 4 == 0 ) |
|
| 133 | - |
|
| 134 | + if( ( $this->year - 1 ) % 4 == 0 ) { |
|
| 135 | + |
|
| 134 | 136 | $this->temp_day = $this->temp_day + 11; |
| 135 | - |
|
| 136 | - else |
|
| 137 | - |
|
| 137 | + } else { |
|
| 138 | + |
|
| 138 | 139 | $this->temp_day = $this->temp_day + 10; |
| 140 | + } |
|
| 139 | 141 | |
| 140 | 142 | $this->year = $this->year - 622; |
| 141 | 143 | |
@@ -145,9 +147,7 @@ discard block |
||
| 145 | 147 | |
| 146 | 148 | $this->day = 30; |
| 147 | 149 | |
| 148 | - } |
|
| 149 | - |
|
| 150 | - else { |
|
| 150 | + } else { |
|
| 151 | 151 | |
| 152 | 152 | $this->month = ( $this->temp_day / 30 ) + 10; |
| 153 | 153 | |
@@ -155,9 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - } |
|
| 159 | - |
|
| 160 | - else { |
|
| 158 | + } else { |
|
| 161 | 159 | |
| 162 | 160 | $this->year = $this->year - 621; |
| 163 | 161 | |
@@ -170,18 +168,14 @@ discard block |
||
| 170 | 168 | $this->month = ( $this->temp_day / 31 ); |
| 171 | 169 | |
| 172 | 170 | $this->day = 31; |
| 173 | - } |
|
| 174 | - |
|
| 175 | - else { |
|
| 171 | + } else { |
|
| 176 | 172 | |
| 177 | 173 | $this->month = ( $this->temp_day / 31 ) + 1; |
| 178 | 174 | |
| 179 | 175 | $this->day = ( $this->temp_day % 31 ); |
| 180 | 176 | } |
| 181 | 177 | |
| 182 | - } |
|
| 183 | - |
|
| 184 | - else { |
|
| 178 | + } else { |
|
| 185 | 179 | |
| 186 | 180 | $this->temp_day = $this->temp_day - 186; |
| 187 | 181 | |
@@ -191,9 +185,7 @@ discard block |
||
| 191 | 185 | |
| 192 | 186 | $this->day = 30; |
| 193 | 187 | |
| 194 | - } |
|
| 195 | - |
|
| 196 | - else { |
|
| 188 | + } else { |
|
| 197 | 189 | |
| 198 | 190 | $this->month = ( $this->temp_day / 30 ) + 7; |
| 199 | 191 | |
@@ -240,7 +232,9 @@ discard block |
||
| 240 | 232 | |
| 241 | 233 | $this->leap = new leap( $this->year ); |
| 242 | 234 | |
| 243 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
| 235 | + if( $this->leap->get() && $this->month > 11 ) { |
|
| 236 | + $this->temp_day++; |
|
| 237 | + } |
|
| 244 | 238 | |
| 245 | 239 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
| 246 | 240 | |
@@ -314,7 +308,9 @@ discard block |
||
| 314 | 308 | |
| 315 | 309 | foreach ( $this->config['shamsi_month_days'] as $month => $value ) { |
| 316 | 310 | |
| 317 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 311 | + if( $this->month > $month ) { |
|
| 312 | + $days_of_year += $value; |
|
| 313 | + } |
|
| 318 | 314 | |
| 319 | 315 | } |
| 320 | 316 | |
@@ -330,9 +326,7 @@ discard block |
||
| 330 | 326 | |
| 331 | 327 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 621 ) / 4 ) ); |
| 332 | 328 | |
| 333 | -} |
|
| 334 | - |
|
| 335 | -elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 329 | +} elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) { |
|
| 336 | 330 | |
| 337 | 331 | $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 622 ) / 4 ) ); |
| 338 | 332 | |
@@ -344,7 +338,9 @@ discard block |
||
| 344 | 338 | |
| 345 | 339 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
| 346 | 340 | |
| 347 | - if ( $gregorian_month < $value ) break; |
|
| 341 | + if ( $gregorian_month < $value ) { |
|
| 342 | + break; |
|
| 343 | + } |
|
| 348 | 344 | |
| 349 | 345 | $gregorian_month -= $value; |
| 350 | 346 | } |
@@ -387,7 +383,9 @@ discard block |
||
| 387 | 383 | |
| 388 | 384 | $this->leap = new leap( $this->year ); |
| 389 | 385 | |
| 390 | - if( $this->leap->get() && $this->month > 11 ) $this->temp_day++; |
|
| 386 | + if( $this->leap->get() && $this->month > 11 ) { |
|
| 387 | + $this->temp_day++; |
|
| 388 | + } |
|
| 391 | 389 | |
| 392 | 390 | $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1; |
| 393 | 391 | |
@@ -460,7 +458,9 @@ discard block |
||
| 460 | 458 | |
| 461 | 459 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
| 462 | 460 | |
| 463 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 461 | + if( $this->month > $month ) { |
|
| 462 | + $days_of_year += $value; |
|
| 463 | + } |
|
| 464 | 464 | |
| 465 | 465 | } |
| 466 | 466 | |
@@ -480,7 +480,9 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | foreach ($this->config['shamsi_month_days'] as $month => $value) { |
| 482 | 482 | |
| 483 | - if ( $shamsi_month < $value ) break; |
|
| 483 | + if ( $shamsi_month < $value ) { |
|
| 484 | + break; |
|
| 485 | + } |
|
| 484 | 486 | |
| 485 | 487 | $shamsi_month -= $value; |
| 486 | 488 | } |
@@ -514,7 +516,9 @@ discard block |
||
| 514 | 516 | |
| 515 | 517 | foreach ( $this->config['islamic_month_days'] as $month => $value ) { |
| 516 | 518 | |
| 517 | - if( $this->month > $month ) $days_of_year += $value; |
|
| 519 | + if( $this->month > $month ) { |
|
| 520 | + $days_of_year += $value; |
|
| 521 | + } |
|
| 518 | 522 | |
| 519 | 523 | } |
| 520 | 524 | |
@@ -534,7 +538,9 @@ discard block |
||
| 534 | 538 | |
| 535 | 539 | foreach ($this->config['gregorian_month_days'] as $month => $value) { |
| 536 | 540 | |
| 537 | - if ( $gregorian_month < $value ) break; |
|
| 541 | + if ( $gregorian_month < $value ) { |
|
| 542 | + break; |
|
| 543 | + } |
|
| 538 | 544 | |
| 539 | 545 | $gregorian_month -= $value; |
| 540 | 546 | } |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | foreach( $this->config['shamsi_month_days'] as $month => $value ) { |
| 82 | 82 | |
| 83 | - if ( $month < $this->month ) $this->result += $value; |
|
| 83 | + if ( $month < $this->month ) { |
|
| 84 | + $this->result += $value; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | } |
| 86 | 88 | |
@@ -103,7 +105,9 @@ discard block |
||
| 103 | 105 | |
| 104 | 106 | foreach( $this->config['islamic_month_days'] as $month => $value ) { |
| 105 | 107 | |
| 106 | - if ( $month < $this->month ) $this->result += $value; |
|
| 108 | + if ( $month < $this->month ) { |
|
| 109 | + $this->result += $value; |
|
| 110 | + } |
|
| 107 | 111 | |
| 108 | 112 | } |
| 109 | 113 | |
@@ -155,7 +159,9 @@ discard block |
||
| 155 | 159 | |
| 156 | 160 | foreach ( $this->config['week_days_name']['persian'] as $key => $value ) { |
| 157 | 161 | |
| 158 | - if( $value == $this->day ) return $key += 1; |
|
| 162 | + if( $value == $this->day ) { |
|
| 163 | + return $key += 1; |
|
| 164 | + } |
|
| 159 | 165 | |
| 160 | 166 | } |
| 161 | 167 | |
@@ -171,7 +177,9 @@ discard block |
||
| 171 | 177 | |
| 172 | 178 | foreach ( $this->config['week_days_name']['islamic'] as $key => $value ) { |
| 173 | 179 | |
| 174 | - if( $value == $this->day ) return $key += 1; |
|
| 180 | + if( $value == $this->day ) { |
|
| 181 | + return $key += 1; |
|
| 182 | + } |
|
| 175 | 183 | |
| 176 | 184 | } |
| 177 | 185 | |