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