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 {