75 lines
1.7 KiB
PHP
75 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace KTXF\People\Collection;
|
|
|
|
use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
|
|
|
|
/**
|
|
* Abstract Collection Properties Base Class
|
|
*
|
|
* Provides common implementation for collection properties
|
|
*
|
|
* @since 2025.05.01
|
|
*/
|
|
abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface {
|
|
|
|
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function content(): array {
|
|
$content = $this->data[self::JSON_PROPERTY_CONTENT] ?? null;
|
|
if (is_array($content)) {
|
|
return array_map(function ($item) {
|
|
return new CollectionContent($item);
|
|
}, $content);
|
|
} else {
|
|
return [];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getLabel(): string {
|
|
return $this->data[self::JSON_PROPERTY_LABEL] ?? '';
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getDescription(): ?string {
|
|
return $this->data[self::JSON_PROPERTY_DESCRIPTION] ?? null;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getPriority(): ?int {
|
|
return $this->data[self::JSON_PROPERTY_PRIORITY] ?? null;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getVisibility(): ?bool {
|
|
return $this->data[self::JSON_PROPERTY_VISIBILITY] ?? null;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getColor(): ?string {
|
|
return $this->data[self::JSON_PROPERTY_COLOR] ?? null;
|
|
}
|
|
|
|
}
|