| Conditions | 6 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function uploadImage(ResourceControllerEvent $event): void |
||
| 42 | { |
||
| 43 | $block = $event->getSubject(); |
||
| 44 | |||
| 45 | if (false === $block instanceof BlockInterface) { |
||
| 46 | return; |
||
| 47 | } |
||
| 48 | |||
| 49 | if (BlockInterface::IMAGE_BLOCK_TYPE !== $block->getType()) { |
||
| 50 | return; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** @var BlockTranslationInterface $translation */ |
||
| 54 | foreach ($block->getTranslations() as $translation) { |
||
| 55 | $image = $translation->getImage(); |
||
| 56 | |||
| 57 | if (null !== $image && true === $image->hasFile()) { |
||
| 58 | $this->uploader->upload($image); |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | } |
||
| 63 |