for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ByTIC\MediaLibrary\PathGenerator;
use ByTIC\MediaLibrary\Media\Media;
/**
* Class AbstractPathGenerator.
*/
abstract class AbstractPathGenerator
{
* @param Media $media
*
* @return string
public static function getBasePathForMediaOriginal($media)
$basePath = self::getBasePathForMedia($media);
$originalPath = $media->getCollection()->getOriginalPath();
if (!empty($originalPath)) {
$basePath .= DIRECTORY_SEPARATOR.$media->getCollection()->getOriginalPath();
}
return $basePath;
public static function getBasePathForMedia($media)
return '/'.$media->getCollection()->getName()
.'/'.static::getFolderNameForMedia($media)
.'/'.$media->getModel()->getPrimaryKey()
$media->getModel()->getPrimaryKey()
array|mixed
concatenation
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
.'/'./** @scrutinizer ignore-type */ $media->getModel()->getPrimaryKey()
.'/';
public static function getFolderNameForMedia($media)
$model = $media->getModel();
if (method_exists($model, 'getFolderNameForMedia')) {
return $model->getFolderNameForMedia();
return $model->getFolderNameForMedia()
Nip\Records\AbstractMode...\Collections\Collection
string
return $media->getModel()->getManager()->getTable();
* @param string $conversionName
public static function getBasePathForMediaConversion($media, $conversionName)
return self::getBasePathForMedia($media).DIRECTORY_SEPARATOR.$conversionName;