refactor: standardize design

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-03 22:10:46 -05:00
parent c0fa9cadfb
commit 36e25f967b
12 changed files with 750 additions and 1076 deletions

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXM\ProviderLocalDocuments\Providers\Personal;
use KTXF\Resource\Documents\Collection\CollectionPropertiesMutableAbstract;
class CollectionProperties extends CollectionPropertiesMutableAbstract {
/**
* Converts store document values into collection properties.
*/
public function fromStore(array|object $data): static {
if (is_object($data)) {
$data = (array) $data;
}
if (isset($data['label'])) {
$this->data[self::JSON_PROPERTY_LABEL] = (string) $data['label'];
}
return $this;
}
/**
* Converts collection properties into store document values.
*/
public function toStore(): array {
return array_filter([
'label' => $this->getLabel(),
], static fn($value) => $value !== null);
}
}