Beispiel #1
0
 /**
  * @inheritdoc
  */
 public function compare(IComparable $other) : int
 {
     if (!$other instanceof static) {
         throw new LogicException('You cannot compare sheep with the goat.');
     }
     return IntervalUtils::numberCmp($this->getTimestamp(), $other->getTimestamp());
 }
 /**
  * # Example:
  *
  *     This:  □□□□□□■■■■■■■■■■■■□□□□□□□□□□□□□□□□□□□□□□□□□□□
  *     Other: □□□□□□□□□□□□□□□□□□■■■■■■■■■■■□□□□□□□□□□□□□□□□
  *                    23:59:59 >< 00:00:00
  *
  * @param DateTimeInterval $other
  * @return bool
  */
 public function isFollowedByAtMidnight(DateTimeInterval $other) : bool
 {
     return IntervalUtils::isSameDate($this->getRight()->getValue(), $other->getLeft()->getValue()->modifyClone('-1 day')) && $this->getRight()->getValue()->format('H:i:s') === '23:59:59' && $other->getLeft()->getValue()->format('H:i:s') === '00:00:00';
 }