mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-17 09:48:41 +00:00
phpstan fixes
This commit is contained in:
parent
5439e1ba11
commit
2f45bf318b
|
|
@ -128,18 +128,22 @@ final class BackendController extends Controller
|
||||||
$view = new View($this->app->l11nManager, $request, $response);
|
$view = new View($this->app->l11nManager, $request, $response);
|
||||||
$view->setTemplate('/Modules/Media/Theme/Backend/media-list');
|
$view->setTemplate('/Modules/Media/Theme/Backend/media-list');
|
||||||
|
|
||||||
$path = (string) ($request->getData('path') ?? '/');
|
$path = (string) ($request->getData('path') ?? '/');
|
||||||
|
|
||||||
|
/** @var Media[] $media */
|
||||||
$media = MediaMapper::getByVirtualPath($path);
|
$media = MediaMapper::getByVirtualPath($path);
|
||||||
|
|
||||||
$collection = CollectionMapper::getParentCollection($path);
|
$collection = CollectionMapper::getParentCollection($path);
|
||||||
if (!empty($collection)) {
|
if (!empty($collection)) {
|
||||||
$media += $collection->getSources();
|
$media += $collection->getSources();
|
||||||
|
|
||||||
|
/** @var string[] $glob */
|
||||||
$glob = \glob(__DIR__ . '/../Files' . \trim($collection->getPath(), '/') . '/' . $collection->getName() . '/*');
|
$glob = \glob(__DIR__ . '/../Files' . \trim($collection->getPath(), '/') . '/' . $collection->getName() . '/*');
|
||||||
|
$glob = $glob === false ? [] : $glob;
|
||||||
|
|
||||||
foreach ($glob as $file) {
|
foreach ($glob as $file) {
|
||||||
foreach ($media as $obj) {
|
foreach ($media as $obj) {
|
||||||
if ($obj->getName() . '.' . $obj->getExtension() === \basename($file)){
|
if ($obj->getName() . '.' . $obj->getExtension() === \basename($file)) {
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +152,7 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
$localMedia = new Media();
|
$localMedia = new Media();
|
||||||
$localMedia->setName($pathinfo['filename']);
|
$localMedia->setName($pathinfo['filename']);
|
||||||
$localMedia->setExtension($pathinfo['extension']);
|
$localMedia->setExtension($pathinfo['extension'] ?? '');
|
||||||
$localMedia->setCreatedBy(new Account());
|
$localMedia->setCreatedBy(new Account());
|
||||||
|
|
||||||
$media[] = $localMedia;
|
$media[] = $localMedia;
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ class MediaMapper extends DataMapperAbstract
|
||||||
* path if so desired without deleting or moving the orginal media files.
|
* path if so desired without deleting or moving the orginal media files.
|
||||||
*
|
*
|
||||||
* @param string $virtualPath Virtual path
|
* @param string $virtualPath Virtual path
|
||||||
* @param string $hidden Get hidden files
|
* @param bool $hidden Get hidden files
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user