id = (int) ($data['id'] ?? 0); $this->name = (string) ($data['name'] ?? ''); $this->debtor = (string) ($data['debtor'] ?? ''); $this->reference = (string) ($data['reference'] ?? ''); $this->type = (int) ($data['type'] ?? 0); $this->tin = (string) ($data['tin'] ?? ''); $this->msicCode = (string) ($data['msic_code'] ?? ''); $this->addressId = (int) ($data['address_id'] ?? 0); $this->districtId = (int) ($data['district_id'] ?? 0); $this->stateId = (int) ($data['state_id'] ?? 0); $this->companyId = (int) ($data['company_id'] ?? 0); $this->streetOne = (string) ($data['street_one'] ?? ''); $this->streetTwo = (string) ($data['street_two'] ?? ''); $this->postCode = (string) ($data['post_code'] ?? ''); $this->identificationReference = (string) ($data['identification_reference'] ?? ''); $this->identificationId = (int) ($data['identification_id'] ?? 0); } public function toArray(): array { return [ 'id' => $this->id, 'name' => $this->name, 'debtor' => $this->debtor, 'reference' => $this->reference, 'type' => $this->type, 'tin' => $this->tin, 'msic_code' => $this->msicCode, 'address_id' => $this->addressId, 'district_id' => $this->districtId, 'state_id' => $this->stateId, 'company_id' => $this->companyId, 'street_one' => $this->streetOne, 'street_two' => $this->streetTwo, 'post_code' => $this->postCode, 'identification_reference' => $this->identificationReference, 'identification_id' => $this->identificationId, ]; } }