當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Reservation::getEndDate方法代碼示例

本文整理匯總了PHP中Reservation::getEndDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Reservation::getEndDate方法的具體用法?PHP Reservation::getEndDate怎麽用?PHP Reservation::getEndDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Reservation的用法示例。


在下文中一共展示了Reservation::getEndDate方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkForValidReservation

 public function checkForValidReservation(Reservation $reservation)
 {
     foreach ($this->reservations as $existingReservation) {
         if ($reservation->getStartDate() >= $existingReservation->getStartDate() && $reservation->getStartDate() <= $existingReservation->getEndDate()) {
             throw new EReservationException($this->roomNumber, $reservation);
         } elseif ($reservation->getEndDate() >= $existingReservation->getStartDate() && $reservation->getEndDate() <= $existingReservation->getEndDate()) {
             throw new EReservationException($this->roomNumber, $reservation);
         }
     }
 }
開發者ID:simeonemanuilov,項目名稱:OOP,代碼行數:10,代碼來源:Room.class.php

示例2: addReservation

 public function addReservation(Reservation $reservation)
 {
     if (!$this->roomIsFree($reservation->getStartDate(), $reservation->getEndDate())) {
         throw new EReservationException();
     }
     $this->reservations[] = $reservation;
 }
開發者ID:reminchev,項目名稱:SoftUni-Projects,代碼行數:7,代碼來源:Room.class.php

示例3:

 function __construct($roomNumber, Reservation $reservation)
 {
     $this->message = "Room " . $roomNumber . " is already occupied for period from " . $reservation->getStartDate()->format("d-m-y") . " to " . $reservation->getEndDate()->format("d-m-y") . PHP_EOL;
 }
開發者ID:TzvetanIG,項目名稱:OOP,代碼行數:4,代碼來源:EReservationException.class.php

示例4: isCollidingReservationExists

 private function isCollidingReservationExists(Reservation $reservation)
 {
     $reservationStartDate = $reservation->getStartDate();
     $reservationEndDate = $reservation->getEndDate();
     for ($i = 0; $i < count($this->reservations); $i++) {
         if ($reservationStartDate > $this->reservations[$i]->getEndDate() || $reservationEndDate < $this->reservations[$i]->getStartDate()) {
             return true;
         }
         return false;
     }
 }
開發者ID:AmaranthInHell,項目名稱:SoftUni,代碼行數:11,代碼來源:Room.class.php

示例5: addReservation

 public function addReservation(Reservation $reservation)
 {
     if (!empty($this->reservations)) {
         foreach ($this->reservations as $res) {
             if ($reservation->getStartDate() >= $res->getStartDate() && $reservation->getStartDate() <= $res->getEndDate()) {
                 throw new EReservationException("A reservation already exists in that period.");
             }
             if ($reservation->getEndDate() >= $res->getStartDate() && $reservation->getEndDate() <= $res->getEndDate()) {
                 throw new EReservationException("A reservation already exists in that period.");
             }
         }
     }
     $this->reservations[] = $reservation;
 }
開發者ID:nok32,項目名稱:SoftUni,代碼行數:14,代碼來源:Room.class.php

示例6: compareTwoReservationsForOverlapping

 private function compareTwoReservationsForOverlapping(Reservation $newReservation, Reservation $existingReservation)
 {
     if ($newReservation->getStartDate() >= $existingReservation->getStartDate() && $newReservation->getStartDate() <= $existingReservation->getEndDate() || $newReservation->getEndDate() <= $existingReservation->getEndDate() && $newReservation->getEndDate() >= $existingReservation->getStartDate() || $newReservation->getStartDate() <= $existingReservation->getStartDate() && $newReservation->getEndDate() >= $existingReservation->getEndDate()) {
         throw new EReservationException();
     }
 }
開發者ID:savin94,項目名稱:SoftUni-Projects,代碼行數:6,代碼來源:Room.class.php

示例7: areOverlappingReservations

 private function areOverlappingReservations(Reservation $reservation1, Reservation $reservation2)
 {
     $secondStartsDuringFirst = $reservation2->getStarDate() >= $reservation1->getStarDate() && $reservation2->getStarDate() <= $reservation1->getEndDate();
     $firstStartsDuringSecond = $reservation1->getStarDate() >= $reservation2->getStarDate() && $reservation1->getStarDate() <= $reservation2->getEndDate();
     return $firstStartsDuringSecond || $secondStartsDuringFirst;
 }
開發者ID:AmaranthInHell,項目名稱:SoftUni-1,代碼行數:6,代碼來源:Room.class.php


注:本文中的Reservation::getEndDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。