@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | // Deal with the end date unless it ends just before midnight at which point we don't need to go further |
| 498 | - if ($this->end_date->format('H:i') == '23:59' ) { |
|
| 498 | + if ($this->end_date->format('H:i') == '23:59') { |
|
| 499 | 499 | $itemized[AbstractEvent::BAT_HOUR][$ey][$em]['d' . $ed] = array(); |
| 500 | 500 | $itemized[AbstractEvent::BAT_MINUTE][$ey][$em]['d' . $ed] = array(); |
| 501 | 501 | } else { |
@@ -522,14 +522,14 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | $counter = (int)$period_start->format('i'); |
| 524 | 524 | $start_minute = $counter; |
| 525 | - foreach($period as $minute) { |
|
| 525 | + foreach ($period as $minute) { |
|
| 526 | 526 | // Doing minutes so set the values in the minute array |
| 527 | - $itemized[AbstractEvent::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')]['m' .$minute->format('i')] = $this->getValue(); |
|
| 527 | + $itemized[AbstractEvent::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')]['m' . $minute->format('i')] = $this->getValue(); |
|
| 528 | 528 | // Let the hours know that it cannot determine availability |
| 529 | - $itemized[AbstractEvent::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')] = -1; |
|
| 529 | + $itemized[AbstractEvent::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = -1; |
|
| 530 | 530 | $counter++; |
| 531 | 531 | |
| 532 | - if ($counter == 60 && $start_minute!==0) { |
|
| 532 | + if ($counter == 60 && $start_minute !== 0) { |
|
| 533 | 533 | // Not a real hour - leave as is and move on |
| 534 | 534 | $counter = 0; |
| 535 | 535 | $start_minute = 0; |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | // Did a real whole hour so initialize the hour |
| 539 | 539 | $itemized[AbstractEvent::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = $this->getValue(); |
| 540 | 540 | // We have a whole hour so get rid of the minute info |
| 541 | - unset($itemized[AbstractEvent::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d'. $minute->format('j')]['h'. $minute->format('G')]); |
|
| 541 | + unset($itemized[AbstractEvent::BAT_MINUTE][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')]); |
|
| 542 | 542 | $counter = 0; |
| 543 | 543 | $start_minute = 0; |
| 544 | 544 | } |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | // Set the end date to the last day of the month so that we are sure to get that last month |
| 561 | 561 | $adjusted_end_day = new \DateTime($this->end_date->format('Y-n-t')); |
| 562 | 562 | |
| 563 | - $daterange = new \DatePeriod($this->start_date, $interval ,$adjusted_end_day); |
|
| 563 | + $daterange = new \DatePeriod($this->start_date, $interval, $adjusted_end_day); |
|
| 564 | 564 | |
| 565 | 565 | $itemized = array(); |
| 566 | 566 | |
@@ -569,10 +569,10 @@ discard block |
||
| 569 | 569 | $start = TRUE; |
| 570 | 570 | |
| 571 | 571 | // Cycle through each month |
| 572 | - foreach($daterange as $date) { |
|
| 572 | + foreach ($daterange as $date) { |
|
| 573 | 573 | |
| 574 | 574 | // Check if we have |
| 575 | - if (($date->format('Y-n') != $old_month) || ($start)) { |
|
| 575 | + if (($date->format('Y-n') != $old_month) || ($start)) { |
|
| 576 | 576 | |
| 577 | 577 | $year = $date->format("Y"); |
| 578 | 578 | $dayinterval = new \DateInterval('P1D'); |
@@ -342,8 +342,7 @@ discard block |
||
| 342 | 342 | if ($this->dateIsEarlier($start) && |
| 343 | 343 | ($this->dateIsInRange($end) || $this->dateIsLater($end))) { |
| 344 | 344 | $overlaps = TRUE; |
| 345 | - } |
|
| 346 | - elseif ($this->dateIsInRange($start) && |
|
| 345 | + } elseif ($this->dateIsInRange($start) && |
|
| 347 | 346 | ($this->dateIsInRange($end) || $this->dateIsLater($end))) { |
| 348 | 347 | $overlaps = TRUE; |
| 349 | 348 | } |
@@ -478,8 +477,7 @@ discard block |
||
| 478 | 477 | $itemized[AbstractEvent::BAT_HOUR][$sy][$sm]['d' . $sd] = $itemized_same_day[AbstractEvent::BAT_HOUR][$sy][$sm]['d' . $sd]; |
| 479 | 478 | $itemized[AbstractEvent::BAT_MINUTE][$sy][$sm]['d' . $sd] = $itemized_same_day[AbstractEvent::BAT_MINUTE][$sy][$sm]['d' . $sd]; |
| 480 | 479 | } |
| 481 | - } |
|
| 482 | - else { |
|
| 480 | + } else { |
|
| 483 | 481 | // Deal with the start day unless it starts on midnight precisely at which point the whole day is booked |
| 484 | 482 | if (!($this->start_date->format('H:i') == '00:00')) { |
| 485 | 483 | $start_period = new \DatePeriod($start_date, $interval, new \DateTime($start_date->format("Y-n-j 23:59:59"))); |
@@ -487,8 +485,7 @@ discard block |
||
| 487 | 485 | $itemized[AbstractEvent::BAT_DAY][$sy][$sm]['d' . $sd] = -1; |
| 488 | 486 | $itemized[AbstractEvent::BAT_HOUR][$sy][$sm]['d' . $sd] = $itemized_start[AbstractEvent::BAT_HOUR][$sy][$sm]['d' . $sd]; |
| 489 | 487 | $itemized[AbstractEvent::BAT_MINUTE][$sy][$sm]['d' . $sd] = $itemized_start[AbstractEvent::BAT_MINUTE][$sy][$sm]['d' . $sd]; |
| 490 | - } |
|
| 491 | - else { |
|
| 488 | + } else { |
|
| 492 | 489 | // Just set an empty hour and minute |
| 493 | 490 | $itemized[AbstractEvent::BAT_HOUR][$sy][$sm]['d' . $sd] = array(); |
| 494 | 491 | $itemized[AbstractEvent::BAT_MINUTE][$sy][$sm]['d' . $sd] = array(); |
@@ -533,8 +530,7 @@ discard block |
||
| 533 | 530 | // Not a real hour - leave as is and move on |
| 534 | 531 | $counter = 0; |
| 535 | 532 | $start_minute = 0; |
| 536 | - } |
|
| 537 | - elseif ($counter == 60 && $start_minute == 0) { |
|
| 533 | + } elseif ($counter == 60 && $start_minute == 0) { |
|
| 538 | 534 | // Did a real whole hour so initialize the hour |
| 539 | 535 | $itemized[AbstractEvent::BAT_HOUR][$minute->format('Y')][$minute->format('n')]['d' . $minute->format('j')]['h' . $minute->format('G')] = $this->getValue(); |
| 540 | 536 | // We have a whole hour so get rid of the minute info |
@@ -582,8 +578,7 @@ discard block |
||
| 582 | 578 | // If we are in the same month the end date is the end date of the event |
| 583 | 579 | if ($this->isSameMonth()) { |
| 584 | 580 | $dayrange = new \DatePeriod($this->start_date, $dayinterval, new \DateTime($this->end_date->format("Y-n-j 23:59:59"))); |
| 585 | - } |
|
| 586 | - else { // alternatively it is the last day of the start month |
|
| 581 | + } else { // alternatively it is the last day of the start month |
|
| 587 | 582 | $dayrange = new \DatePeriod($this->start_date, $dayinterval, $this->endMonthDate($this->start_date)); |
| 588 | 583 | } |
| 589 | 584 | foreach ($dayrange as $day) { |