/** * Checks if this date-time is equal to another date-time. * <p> * The comparison is based on the local date-time and the offset. * To compare for the same instant on the time-line, use {@link #isEqual}. * Only objects of type {@code OffsetDateTime} are compared, other types return false. * * @param mixed $obj the object to check, null returns false * @return true if this is equal to the other date-time */ public function equals($obj) { if ($this === $obj) { return true; } if ($obj instanceof OffsetDateTime) { $other = $obj; return $this->dateTime->equals($other->dateTime) && $this->offset->equals($other->offset); } return false; }
/** * Checks if this object equals another. * <p> * The entire state of the object is compared. * * @param mixed $other the other object to compare to, null returns false * @return bool true if equal */ public function equals($other) { if ($other === $this) { return true; } if ($other instanceof ZoneOffsetTransition) { $d = $other; return $this->transition->equals($d->transition) && $this->offsetBefore->equals($d->offsetBefore) && $this->offsetAfter->equals($d->offsetAfter); } return false; }
/** * Checks if this object equals another. * <p> * The entire state of the object is compared. * * @param mixed $otherRule the other object to compare to, null returns false * @return bool true if equal */ public function equals($otherRule) { if ($otherRule === $this) { return true; } if ($otherRule instanceof ZoneOffsetTransitionRule) { $other = $otherRule; return $this->month == $other->month && $this->dom == $other->dom && $this->dow == $other->dow && $this->timeDefinition == $other->timeDefinition && $this->time->equals($other->time) && $this->timeEndOfDay == $other->timeEndOfDay && $this->standardOffset->equals($other->standardOffset) && $this->offsetBefore->equals($other->offsetBefore) && $this->offsetAfter->equals($other->offsetAfter); } return false; }
/** * Checks if this time is equal to another time. * <p> * The comparison is based on the local-time and the offset. * To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}. * <p> * Only objects of type {@code OffsetTime} are compared, other types return false. * To compare the underlying local time of two {@code TemporalAccessor} instances, * use {@link ChronoField#NANO_OF_DAY} as a comparator. * * @param mixed $obj the object to check, null returns false * @return true if this is equal to the other time */ public function equals($obj) { if ($this === $obj) { return true; } if ($obj instanceof OffsetTime) { /** @var OffsetTime $other */ $other = $obj; return $this->time->equals($other->time) && $this->offset->equals($other->offset); } return false; }