Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| OrderAttributeConverter | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| applyToDomain | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| applyToStorage | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\StorageMetadata\PropertyConverters; |
| 3 | |
| 4 | use Apie\StorageMetadata\Attributes\OrderAttribute; |
| 5 | use Apie\StorageMetadata\Interfaces\PropertyConverterInterface; |
| 6 | use Apie\StorageMetadata\Mediators\DomainToStorageContext; |
| 7 | |
| 8 | class OrderAttributeConverter implements PropertyConverterInterface |
| 9 | { |
| 10 | public function applyToDomain( |
| 11 | DomainToStorageContext $context |
| 12 | ): void { |
| 13 | // no-op |
| 14 | } |
| 15 | |
| 16 | public function applyToStorage( |
| 17 | DomainToStorageContext $context |
| 18 | ): void { |
| 19 | foreach ($context->storageProperty->getAttributes(OrderAttribute::class) as $propertyAttribute) { |
| 20 | $context->setStoragePropertyValue($context->arrayKey); |
| 21 | } |
| 22 | } |
| 23 | } |