| Conditions | 5 | 
| Paths | 6 | 
| Total Lines | 16 | 
| Code Lines | 11 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 1 | Features | 0 | 
| 1 | <?php | ||
| 25 | public function uploadMedia(GenericEvent $event): void | ||
| 26 |     { | ||
| 27 | $subject = $event->getSubject(); | ||
| 28 | Assert::isInstanceOf($subject, HasSeoInterface::class); | ||
| 29 | $seo = $subject->getSeo(); | ||
| 30 | Assert::isInstanceOf($seo, SeoInterface::class); | ||
| 31 | /** @var SeoTranslationInterface $translation */ | ||
| 32 |         foreach ($seo->getTranslations() as $translation) { | ||
| 33 | $image = $translation->getImage(); | ||
| 34 |             if ($image instanceof SeoImageInterface) { | ||
| 35 |                 if ($image->hasFile()) { | ||
| 36 | $this->uploader->upload($image); | ||
| 37 | } | ||
| 38 | // Upload failed? Let's remove that image. | ||
| 39 |                 if (null === $image->getPath()) { | ||
| 40 | $translation->setImage(null); | ||
| 41 | } | ||
| 46 |