当前位置: 首页>>代码示例>>PHP>>正文


PHP Reservation::getStartDate方法代码示例

本文整理汇总了PHP中Reservation::getStartDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Reservation::getStartDate方法的具体用法?PHP Reservation::getStartDate怎么用?PHP Reservation::getStartDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reservation的用法示例。


在下文中一共展示了Reservation::getStartDate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Reservation::getStartDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。