Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| ItemListObjectStrategy | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
6 | |
100.00% |
1 / 1 |
| supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCreationMetadata | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getModificationMetadata | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getResultMetadata | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Metadata\Strategy; |
| 3 | |
| 4 | use Apie\Core\Context\ApieContext; |
| 5 | use Apie\Core\Lists\ItemList; |
| 6 | use Apie\Core\Lists\ItemSet; |
| 7 | use Apie\Core\Metadata\ItemListMetadata; |
| 8 | use Apie\Core\Metadata\StrategyInterface; |
| 9 | use Apie\Core\Utils\HashmapUtils; |
| 10 | use ReflectionClass; |
| 11 | |
| 12 | final class ItemListObjectStrategy implements StrategyInterface |
| 13 | { |
| 14 | public static function supports(ReflectionClass $class): bool |
| 15 | { |
| 16 | return HashmapUtils::isList($class) || HashmapUtils::isSet($class); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * @param ReflectionClass<ItemList|ItemSet> $class |
| 21 | */ |
| 22 | public function __construct(private readonly ReflectionClass $class) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | public function getCreationMetadata(ApieContext $context): ItemListMetadata |
| 27 | { |
| 28 | return new ItemListMetadata($this->class, true); |
| 29 | } |
| 30 | |
| 31 | public function getModificationMetadata(ApieContext $context): ItemListMetadata |
| 32 | { |
| 33 | return new ItemListMetadata($this->class, true); |
| 34 | } |
| 35 | |
| 36 | public function getResultMetadata(ApieContext $context): ItemListMetadata |
| 37 | { |
| 38 | return new ItemListMetadata($this->class, false); |
| 39 | } |
| 40 | } |