| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function generatePath(MediaInterface $media) |
||
| 24 | { |
||
| 25 | $segments = preg_split('#/#', $media->getId(), -1, PREG_SPLIT_NO_EMPTY); |
||
| 26 | |||
| 27 | if (\count($segments) > 1) { |
||
| 28 | // remove last part from id |
||
| 29 | array_pop($segments); |
||
| 30 | $path = implode('/', $segments); |
||
| 31 | } else { |
||
| 32 | $path = ''; |
||
| 33 | } |
||
| 34 | |||
| 35 | return $path ? sprintf('%s/%s', $media->getContext(), $path) : $media->getContext(); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |