/** * @param ValueObjectInterface $other * @return boolean */ public function sameValueAs(ValueObjectInterface $other) { if (!$other instanceof EventsDefinition) { return false; } if (count($this->eventDescriptions()) !== count($other->eventDescriptions())) { return false; } foreach ($this->eventDescriptions() as $eventName => $eventDescription) { if (!isset($other->eventDescriptions()[$eventName])) { return false; } if (!$eventDescription->sameValueAs($other->eventDescriptions()[$eventName])) { return false; } } return true; }