label = $label; $this->type = $type; $this->required = $required; $this->position = $position; } /** * @return Id */ public function getId() { return $this->id; } /** * @param Id $id */ public function setId($id) { $this->id = $id; } /** * @return Label */ public function getLabel() { return $this->label; } /** * @param Label $label */ public function setLabel($label) { $this->label = $label; } /** * @return CustomFieldType */ public function getType() { return $this->type; } /** * @param CustomFieldType $type */ public function setType($type) { $this->type = $type; } /** * @return BooleanValueObject */ public function getRequired() { return $this->required; } /** * @param BooleanValueObject $required */ public function setRequired($required) { $this->required = $required; } /** * @return IntegerValue */ public function getPosition() { return $this->position; } /** * @param IntegerValue $position */ public function setPosition($position) { $this->position = $position; } /** * @return Collection */ public function getOptions() { return $this->options; } /** * @param Collection $options */ public function setOptions($options) { $this->options = $options; } /** * @return Collection */ public function getServices() { return $this->services; } /** * @param Collection $services */ public function setServices($services) { $this->services = $services; } /** * @return array */ public function toArray() { return [ 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, 'label' => $this->getLabel()->getValue(), 'type' => $this->getType()->getValue(), 'required' => $this->getRequired()->getValue(), 'position' => $this->getPosition()->getValue(), 'options' => $this->getOptions() ? $this->getOptions()->toArray() : [], 'services' => $this->getServices() ? $this->getServices()->toArray() : [] ]; } }