getValue()) { throw new InvalidArgumentException('Duration cannot be zero.'); } parent::__construct($name, $price); $this->minCapacity = $minCapacity; $this->maxCapacity = $maxCapacity; $this->duration = $duration; $this->categoryId = $categoryId; $this->status = $status; } /** * @return Id */ public function getCategoryId() { return $this->categoryId; } /** * @param Id $categoryId */ public function setCategoryId(Id $categoryId) { $this->categoryId = $categoryId; } /** * @return Status */ public function getStatus() { return $this->status; } /** * @param Status $status */ public function setStatus(Status $status) { $this->status = $status; } /** * @return IntegerValue */ public function getMinCapacity() { return $this->minCapacity; } /** * @param IntegerValue $minCapacity */ public function setMinCapacity(IntegerValue $minCapacity) { $this->minCapacity = $minCapacity; } /** * @return IntegerValue */ public function getMaxCapacity() { return $this->maxCapacity; } /** * @param IntegerValue $maxCapacity */ public function setMaxCapacity(IntegerValue $maxCapacity) { $this->maxCapacity = $maxCapacity; } /** * @return PositiveDuration */ public function getDuration() { return $this->duration; } /** * @param PositiveDuration $duration */ public function setDuration(PositiveDuration $duration) { $this->duration = $duration; } /** * @return Duration */ public function getTimeBefore() { return $this->timeBefore; } /** * @param Duration $timeBefore */ public function setTimeBefore(Duration $timeBefore) { $this->timeBefore = $timeBefore; } /** * @return Duration */ public function getTimeAfter() { return $this->timeAfter; } /** * @param Duration $timeAfter */ public function setTimeAfter(Duration $timeAfter) { $this->timeAfter = $timeAfter; } /** * @return BooleanValueObject */ public function getBringingAnyone() { return $this->bringingAnyone; } /** * @param BooleanValueObject $bringingAnyone */ public function setBringingAnyone(BooleanValueObject $bringingAnyone) { $this->bringingAnyone = $bringingAnyone; } /** * @return Priority */ public function getPriority() { return $this->priority; } /** * @param Priority $priority */ public function setPriority(Priority $priority) { $this->priority = $priority; } /** * @return Collection */ public function getGallery() { return $this->gallery; } /** * @param Collection $gallery */ public function setGallery(Collection $gallery) { $this->gallery = $gallery; } /** * @return array */ public function toArray() { return array_merge( parent::toArray(), [ 'minCapacity' => $this->getMinCapacity() ? $this->getMinCapacity()->getValue() : null, 'maxCapacity' => $this->getMaxCapacity() ? $this->getMaxCapacity()->getValue() : null, 'duration' => $this->getDuration() ? $this->getDuration()->getValue() : null, 'timeBefore' => $this->getTimeBefore() ? $this->getTimeBefore()->getValue() : null, 'timeAfter' => $this->getTimeAfter() ? $this->getTimeAfter()->getValue() : null, 'bringingAnyone' => $this->getBringingAnyone() ? $this->getBringingAnyone()->getValue() : null, 'status' => $this->getStatus()->getValue(), 'categoryId' => $this->getCategoryId()->getValue(), 'priority' => $this->getPriority() ? $this->getPriority()->getValue() : [], 'gallery' => $this->getGallery() ? $this->getGallery()->toArray() : [] ] ); } }