type !== null) { self::requireIn($this->type, ['individual', 'company'], 'type'); } if ($this->documentType !== null) { self::requireIn($this->documentType, ['CPF', 'CNPJ'], 'document_type'); } } public function toArray(): array { return $this->filterFilledRecursive([ 'name' => $this->name, 'email' => $this->email, 'document' => $this->document, 'type' => $this->type, 'document_type' => $this->documentType, 'code' => $this->code, 'address' => $this->address, 'phones' => $this->phones, ]); } }