Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| StoredFileDtoTransformer | |
100.00% |
2 / 2 |
|
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| __invoke | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Shared\Infrastructure\Service; |
| 4 | |
| 5 | use App\Shared\Domain\Model\StoredFile; |
| 6 | use App\Shared\Infrastructure\Dto\StoredFileDto; |
| 7 | use Symfony\Component\ObjectMapper\ObjectMapperInterface; |
| 8 | use Symfony\Component\ObjectMapper\TransformCallableInterface; |
| 9 | |
| 10 | /** |
| 11 | * @author Wilhelm Zwertvaegher |
| 12 | * @implements TransformCallableInterface<StoredFile, StoredFileDto> |
| 13 | */ |
| 14 | readonly class StoredFileDtoTransformer implements TransformCallableInterface |
| 15 | { |
| 16 | |
| 17 | public function __construct( |
| 18 | private ObjectMapperInterface $objectMapper |
| 19 | |
| 20 | ) { |
| 21 | } |
| 22 | |
| 23 | public function __invoke(mixed $value, object $source, ?object $target): mixed |
| 24 | { |
| 25 | return null === $value ? null : $this->objectMapper->map($value, StoredFileDto::class); |
| 26 | } |
| 27 | } |