public function toArray() { if ($this->app !== null) { return ['app' => $this->app->toArray()]; } if ($this->module !== null) { return ['module' => $this->module->toArray()]; } return []; }