service_name = $service; } public function getService_name():string { return $this->service_name; } /** * @param ?string $content must match what integration expects * @return self */ public function setContentType(?string $content):self { if (is_null($content)) { return $this; } $connection = JVB()->connect($this->service_name); if (!$connection){ error_log('[Integration]::setContentType Service is not setup. '.$this->service_name); return $this; } $allowed = $connection->getAllowedContent(); if (!in_array($content, $allowed)) { error_log($this->service_name.' Connection does not support this content: '.$content); return $this; } $this->content_type = $content; return $this; } public function getContentType():?string { return $this->content_type; } public function setInitial(bool $set):self { $this->initial = $set; return $this; } public function getInitial():bool|null { return $this->initial??null; } public function setUpdate(bool $set):self { $this->update = $set; return $this; } public function getUpdate():bool|null { return $this->update ?? null; } public function setCustomer(bool $set):self { $this->isCustomer = $set; return $this; } public function isCustomer():bool { return $this->isCustomer??false; } public function setCanSchedule(bool $set):self { $this->canSchedule = $set; return $this; } public function getCanSchedule():bool|null { return $this->canSchedule??null; } public function getConfig(): array { $config = []; if (isset($this->content_type)) { $config['content_type'] = $this->content_type; } if (isset($this->initial)) { $config['initial'] = $this->initial; } if (isset($this->update)) { $config['update'] = $this->update; } return $config; } }