/** * @return array */ public function toArray() { $return = parent::toArray(); if ($this->intervention !== null) { if (!$this->intervention instanceof Intervention) { throw new \Bixev\InterventionSdk\Exception('invalid intervention instance (must be instanceof \\Bixev\\InterventionSdk\\Intervention'); } $return['intervention'] = $this->intervention->toArray(); } if ($this->custom_fields !== null) { if (!$this->custom_fields instanceof InterventionReportCustomFields) { throw new \Bixev\InterventionSdk\Exception('invalid custom_fields instance (must be instanceof \\Bixev\\InterventionSdk\\InterventionReportCustomFields'); } $return['custom_fields'] = $this->custom_fields->toArray(); } return $return; }