refactor: use unified service provider desing
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user