Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.0932 |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
33 | 1 | public static function createForMedia(Media $media, string $conversionName = ''): UrlGeneratorInterface |
|
34 | { |
||
35 | 1 | $urlGenerator = static::create() |
|
36 | 1 | ->setMedia($media); |
|
37 | |||
38 | 1 | if (!empty($conversionName)) { |
|
39 | /** @noinspection PhpUnhandledExceptionInspection */ |
||
40 | $conversion = $media->getConversions()->getByName($conversionName); |
||
41 | |||
42 | $urlGenerator->setConversion($conversion); |
||
43 | } |
||
44 | |||
45 | 1 | return $urlGenerator; |
|
46 | } |
||
48 |