Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
ScalarStrategy | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
supports | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__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\Enums\ScalarType; |
6 | use Apie\Core\Metadata\ScalarMetadata; |
7 | use Apie\Core\Metadata\StrategyInterface; |
8 | use ReflectionClass; |
9 | use stdClass; |
10 | |
11 | final class ScalarStrategy implements StrategyInterface |
12 | { |
13 | public static function supports(ReflectionClass $class): bool |
14 | { |
15 | return $class->name === stdClass::class; |
16 | } |
17 | |
18 | public function __construct(private readonly ScalarType $scalarType) |
19 | { |
20 | } |
21 | |
22 | public function getCreationMetadata(ApieContext $context): ScalarMetadata |
23 | { |
24 | return new ScalarMetadata($this->scalarType); |
25 | } |
26 | |
27 | public function getModificationMetadata(ApieContext $context): ScalarMetadata |
28 | { |
29 | return new ScalarMetadata($this->scalarType); |
30 | } |
31 | |
32 | public function getResultMetadata(ApieContext $context): ScalarMetadata |
33 | { |
34 | return new ScalarMetadata($this->scalarType); |
35 | } |
36 | } |