Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
2 / 2 |
|
80.00% |
4 / 5 |
|
66.67% |
2 / 3 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| StoredFileUrlTransformer | |
100.00% |
2 / 2 |
|
80.00% |
4 / 5 |
|
66.67% |
2 / 3 |
|
100.00% |
2 / 2 |
3.33 | |
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 |
|
75.00% |
3 / 4 |
|
50.00% |
1 / 2 |
|
100.00% |
1 / 1 |
2.50 | |||
| 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 App\Shared\Infrastructure\Persistence\Doctrine\Entity\DoctrineStoredFile; |
| 8 | use Doctrine\ORM\Internal\StronglyConnectedComponents; |
| 9 | use Symfony\Component\ObjectMapper\ObjectMapper; |
| 10 | use Symfony\Component\ObjectMapper\ObjectMapperInterface; |
| 11 | use Symfony\Component\ObjectMapper\TransformCallableInterface; |
| 12 | |
| 13 | /** |
| 14 | * @author Wilhelm Zwertvaegher |
| 15 | * @implements TransformCallableInterface<StoredFile, StoredFileDto> |
| 16 | */ |
| 17 | readonly class StoredFileUrlTransformer implements TransformCallableInterface |
| 18 | { |
| 19 | |
| 20 | public function __construct( |
| 21 | private FileStorageProvider $fileStorageProvider |
| 22 | ) { |
| 23 | } |
| 24 | |
| 25 | public function __invoke(mixed $value, object $source, ?object $target): mixed |
| 26 | { |
| 27 | return null === $value ? null : $this->fileStorageProvider->generateUrl($source); |
| 28 | } |
| 29 | } |