* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXF\Resource\Documents\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; public function content(): CollectionContent { $content = $this->data[self::JSON_PROPERTY_CONTENTS] ?? null; if ($content instanceof CollectionContent) { return $content; } if (is_string($content)) { return CollectionContent::tryFrom($content) ?? CollectionContent::File; } return CollectionContent::File; } public function getLabel(): string { return $this->data[self::JSON_PROPERTY_LABEL] ?? ''; } }