| Total Complexity | 6 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 77.78% |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 10 | abstract class AbstractPathGenerator |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param Media $media |
||
| 14 | * |
||
| 15 | * @return string |
||
| 16 | */ |
||
| 17 | 2 | public static function getBasePathForMediaOriginal($media) |
|
| 18 | { |
||
| 19 | 2 | $basePath = self::getBasePathForMedia($media); |
|
| 20 | 2 | $originalPath = $media->getCollection()->getOriginalPath(); |
|
| 21 | 2 | if (!empty($originalPath)) { |
|
| 22 | $basePath .= DIRECTORY_SEPARATOR . $media->getCollection()->getOriginalPath(); |
||
| 23 | } |
||
| 24 | |||
| 25 | 2 | return $basePath; |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param Media $media |
||
| 30 | * |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | 7 | public static function getBasePathForMedia($media) |
|
| 34 | { |
||
| 35 | 7 | return '/' . $media->getCollection()->getName() |
|
| 36 | 7 | . '/' . static::getFolderNameForMedia($media) |
|
| 37 | 7 | . '/' . $media->getModel()->getPrimaryKey() |
|
| 38 | 7 | . '/'; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param Media $media |
||
| 43 | * |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | 7 | public static function getFolderNameForMedia($media) |
|
| 47 | { |
||
| 48 | 7 | $model = $media->getModel(); |
|
| 49 | 7 | if (method_exists($model, 'getFolderNameForMedia')) { |
|
| 50 | 7 | return $model->getFolderNameForMedia(); |
|
|
|
|||
| 51 | } |
||
| 52 | |||
| 53 | return $media->getModel()->getManager()->getTable(); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param Media $media |
||
| 58 | * @param string $conversionName |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public static function getBasePathForMediaConversion($media, $conversionName) |
||
| 65 | } |
||
| 66 | } |
||
| 67 |