Example #1
0
 /**
  * Returns the highest LocalTime among the given values.
  *
  * @param LocalTime ... $times The LocalTime objects to compare.
  *
  * @return LocalTime The latest LocalTime object.
  *
  * @throws DateTimeException If the array is empty.
  */
 public static function maxOf(LocalTime ...$times)
 {
     if (!$times) {
         throw new DateTimeException(__METHOD__ . ' does not accept less than 1 parameter.');
     }
     $max = LocalTime::min();
     foreach ($times as $time) {
         if ($time->isAfter($max)) {
             $max = $time;
         }
     }
     return $max;
 }
Example #2
0
 /**
  * Returns the smallest possible value for LocalDateTime.
  *
  * @return LocalDateTime
  */
 public static function min()
 {
     return new LocalDateTime(LocalDate::min(), LocalTime::min());
 }
Example #3
0
 public function testMin()
 {
     $this->assertLocalTimeIs(0, 0, 0, 0, LocalTime::min());
 }