refactor: use unified service provider desing

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-25 23:47:24 -04:00
parent 6ca83a7dd7
commit a7ad86860d
5 changed files with 7 additions and 10 deletions
@@ -20,17 +20,15 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
*/
abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface {
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
/**
* @inheritDoc
*/
public function content(): array {
$content = $this->data[self::PROPERTY_CONTENT] ?? null;
if (is_array($content)) {
return array_map(function ($item) {
return new CollectionContent($item);
}, $content);
return array_filter(array_map(function ($item) {
return $item instanceof CollectionContent ? $item : CollectionContent::tryFrom($item);
}, $content));
} else {
return [];
}
@@ -10,7 +10,6 @@ declare(strict_types=1);
namespace KTXF\People\Collection;
use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
use PhpParser\Node\Expr\Array_;
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
@@ -9,8 +9,8 @@ declare(strict_types=1);
namespace KTXF\People\Provider;
use KTXF\Chrono\Service\ServiceMutableInterface;
use KTXF\Mail\Service\ServiceBaseInterface;
use KTXF\People\Service\ServiceBaseInterface;
use KTXF\People\Service\ServiceMutableInterface;
/**
* Provider Service Test Interface
@@ -21,7 +21,7 @@ use KTXF\Resource\Range\RangeType;
use KTXF\Resource\Sort\ISort;
/**
* People Service Base Interface
* Service Base Interface
*
* Minimum interface for a service, providing read-only access to collections and entities.
*
@@ -15,7 +15,7 @@ use KTXF\People\Collection\CollectionPropertiesBaseInterface;
use KTXF\Resource\Identifier\CollectionIdentifierInterface;
/**
* People Service Collection Mutable Interface
* Service Collection Mutable Interface
*
* Optional interface for services that support collection CRUD operations.
*