Пример #1
0
 /**
  * Returns the highest LocalDateTime among the given values.
  *
  * @param LocalDateTime ... $times The LocalDateTime objects to compare.
  *
  * @return LocalDateTime The latest LocalDateTime object.
  *
  * @throws DateTimeException If the array is empty.
  */
 public static function maxOf(LocalDateTime ...$times)
 {
     if (!$times) {
         throw new DateTimeException(__METHOD__ . ' does not accept less than 1 parameter.');
     }
     $max = LocalDateTime::min();
     foreach ($times as $time) {
         if ($time->isAfter($max)) {
             $max = $time;
         }
     }
     return $max;
 }
Пример #2
0
 public function testMin()
 {
     $this->assertLocalDateTimeIs(Year::MIN_VALUE, 1, 1, 0, 0, 0, 0, LocalDateTime::min());
 }