HEX
Server: LiteSpeed
System: Linux d8 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: wbwebdes (3015)
PHP: 8.1.31
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/wbwebdes/domains/files.wb-cloud.nl/private_html/apps/related_resources/lib/Model/Calendar.php
<?php

declare(strict_types=1);


/**
 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */


namespace OCA\RelatedResources\Model;

use JsonSerializable;
use OCA\RelatedResources\Tools\Db\IQueryRow;
use OCA\RelatedResources\Tools\Traits\TArrayTools;

class Calendar implements IQueryRow, JsonSerializable {
	use TArrayTools;

	private int $calendarId = 0;
	private string $calendarName = '';
	private string $calendarPrincipalUri = '';
	private string $calendarUri = '';

	public function __construct() {
	}

	public function getId(): string {
		return $this->getCalendarPrincipalUri() . ':' . $this->getCalendarUri();
	}

	public function setCalendarId(int $calendarId): self {
		$this->calendarId = $calendarId;

		return $this;
	}

	public function getCalendarId(): int {
		return $this->calendarId;
	}

	public function setCalendarName(string $calendarName): self {
		$this->calendarName = $calendarName;

		return $this;
	}

	public function getCalendarName(): string {
		return $this->calendarName;
	}

	public function setCalendarPrincipalUri(string $calendarPrincipalUri): self {
		$this->calendarPrincipalUri = $calendarPrincipalUri;

		return $this;
	}

	public function getCalendarPrincipalUri(): string {
		return $this->calendarPrincipalUri;
	}

	public function setCalendarUri(string $calendarUri): self {
		$this->calendarUri = $calendarUri;

		return $this;
	}

	public function getCalendarUri(): string {
		return $this->calendarUri;
	}

	public function importFromDatabase(array $data): IQueryRow {
		$this->setCalendarId($this->getInt('id', $data))
			->setCalendarName($this->get('displayname', $data))
			->setCalendarPrincipalUri($this->get('principaluri', $data))
			->setCalendarUri($this->get('uri', $data));

		return $this;
	}

	public function jsonSerialize(): array {
		return [
			'calendarName' => $this->getCalendarName(),
			'calendarPrincipalUri' => $this->getCalendarPrincipalUri(),
			'calendarUri' => $this->getCalendarUri()
		];
	}
}