/** * @param Activity $activity * * @return boolean */ public function isEqualTo(Activity $activity) { if ($activity->getBundle()->getId() !== $this->bundle->getId()) { return false; } // Compare developers only if actual activity has one if (null !== $this->developer && $activity->getDeveloper()->getId() !== $this->developer->getId()) { return false; } if ($activity->getType() !== $this->type) { return false; } if ($activity->getState() !== $this->state) { return false; } // Compare dates only when state of activity allows it if (self::STATE_FIXED !== $this->state && $activity->getCreatedAt()->getTimestamp() !== $this->createdAt->getTimestamp()) { return false; } return true; }