2024-07-10 16:20:44 -04:00
|
|
|
<?php
|
|
|
|
|
|
2024-07-24 19:47:14 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2024-07-10 16:20:44 -04:00
|
|
|
/**
|
|
|
|
|
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
2024-07-12 14:27:24 -04:00
|
|
|
namespace OCP\Files\Template;
|
2024-07-10 16:20:44 -04:00
|
|
|
|
2024-07-24 19:41:52 -04:00
|
|
|
/**
|
|
|
|
|
* @since 30.0.0
|
|
|
|
|
*/
|
2024-07-12 14:27:24 -04:00
|
|
|
class Field implements \JsonSerializable {
|
2024-07-16 12:06:05 -04:00
|
|
|
private string $index;
|
2024-07-10 16:20:44 -04:00
|
|
|
private string $content;
|
2024-07-12 14:27:24 -04:00
|
|
|
private FieldType $type;
|
2024-07-16 15:54:31 -04:00
|
|
|
private ?string $alias;
|
2024-07-12 14:27:24 -04:00
|
|
|
private ?int $id;
|
|
|
|
|
private ?string $tag;
|
|
|
|
|
|
2024-07-24 19:41:52 -04:00
|
|
|
/**
|
|
|
|
|
* @since 30.0.0
|
|
|
|
|
*/
|
2024-07-24 19:47:14 -04:00
|
|
|
public function __construct(string $index, string $content, FieldType $type, ?string $alias = null, ?int $id = null, ?string $tag = null) {
|
2024-07-12 14:27:24 -04:00
|
|
|
$this->index = $index;
|
2024-07-16 15:54:31 -04:00
|
|
|
$this->alias = $alias;
|
2024-07-24 19:47:14 -04:00
|
|
|
$this->type = $type;
|
2024-07-12 14:27:24 -04:00
|
|
|
$this->id = $id;
|
|
|
|
|
$this->tag = $tag;
|
|
|
|
|
$this->content = $content;
|
|
|
|
|
}
|
2024-07-10 16:20:44 -04:00
|
|
|
|
2024-07-24 19:41:52 -04:00
|
|
|
/**
|
|
|
|
|
* @since 30.0.0
|
|
|
|
|
*/
|
2024-07-12 14:27:24 -04:00
|
|
|
public function jsonSerialize(): array {
|
|
|
|
|
return [
|
|
|
|
|
"index" => $this->index,
|
|
|
|
|
"content" => $this->content,
|
|
|
|
|
"type" => $this->type->value,
|
2024-07-16 15:54:31 -04:00
|
|
|
"alias" => $this->alias,
|
2024-07-12 14:27:24 -04:00
|
|
|
"id" => $this->id,
|
|
|
|
|
"tag" => $this->tag,
|
|
|
|
|
];
|
2024-07-10 16:20:44 -04:00
|
|
|
}
|
|
|
|
|
}
|