mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-16 09:18:42 +00:00
phpstan fixes
This commit is contained in:
parent
3d04648460
commit
799ac6b012
|
|
@ -62,7 +62,7 @@ final class ApiController extends Controller
|
||||||
public function apiMediaUpload(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
public function apiMediaUpload(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||||
{
|
{
|
||||||
$uploads = $this->uploadFiles(
|
$uploads = $this->uploadFiles(
|
||||||
$request->getData('name') === null || $request->getFiles() !== null ? '' : $request->getData('name'),
|
$request->getData('name') === null || \count($request->getFiles()) > 1 ? '' : $request->getData('name'),
|
||||||
$request->getFiles(),
|
$request->getFiles(),
|
||||||
$request->header->account,
|
$request->header->account,
|
||||||
__DIR__ . '/../../../Modules/Media/Files' . \urldecode((string) ($request->getData('path') ?? '')),
|
__DIR__ . '/../../../Modules/Media/Files' . \urldecode((string) ($request->getData('path') ?? '')),
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class Collection extends Media implements \Iterator
|
||||||
/**
|
/**
|
||||||
* Resource id.
|
* Resource id.
|
||||||
*
|
*
|
||||||
* @var Media[]
|
* @var array<int, Media>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private array $sources = [];
|
private array $sources = [];
|
||||||
|
|
@ -113,7 +113,7 @@ class Collection extends Media implements \Iterator
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function current()
|
public function current() : Media
|
||||||
{
|
{
|
||||||
return \current($this->sources);
|
return \current($this->sources);
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +121,7 @@ class Collection extends Media implements \Iterator
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function key()
|
public function key() : ?int
|
||||||
{
|
{
|
||||||
return \key($this->sources);
|
return \key($this->sources);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,18 +120,19 @@ final class CollectionMapper extends MediaMapper
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function getCollectionsByPath(string $path, bool $showDirectories = false) : array
|
public static function getCollectionsByPath(string $virtualPath, bool $showDirectories = false) : array
|
||||||
{
|
{
|
||||||
$collection = self::getByVirtualPath($path);
|
/** @var Media[] $collection */
|
||||||
|
$collection = self::getByVirtualPath($virtualPath);
|
||||||
$parent = [];
|
$parent = [];
|
||||||
|
|
||||||
if ($showDirectories) {
|
if ($showDirectories) {
|
||||||
$parent = self::getParentCollection($path);
|
$parent = self::getParentCollection($virtualPath);
|
||||||
if (\is_array($parent) && \is_dir(__DIR__ . '/../../Media/Files' . $path)) {
|
if (\is_array($parent) && \is_dir(__DIR__ . '/../../Media/Files' . $virtualPath)) {
|
||||||
$parent = new Collection();
|
$parent = new Collection();
|
||||||
$parent->name = \basename($path);
|
$parent->name = \basename($virtualPath);
|
||||||
$parent->setVirtualPath(\dirname($path));
|
$parent->setVirtualPath(\dirname($virtualPath));
|
||||||
$parent->setPath(\dirname($path));
|
$parent->setPath(\dirname($virtualPath));
|
||||||
$parent->isAbsolute = false;
|
$parent->isAbsolute = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,7 +166,7 @@ final class CollectionMapper extends MediaMapper
|
||||||
$localMedia = new Collection();
|
$localMedia = new Collection();
|
||||||
$localMedia->name = $pathinfo['filename'];
|
$localMedia->name = $pathinfo['filename'];
|
||||||
$localMedia->extension = \is_dir($file) ? 'collection' : $pathinfo['extension'] ?? '';
|
$localMedia->extension = \is_dir($file) ? 'collection' : $pathinfo['extension'] ?? '';
|
||||||
$localMedia->setVirtualPath($path);
|
$localMedia->setVirtualPath($virtualPath);
|
||||||
$localMedia->createdBy = new Account();
|
$localMedia->createdBy = new Account();
|
||||||
|
|
||||||
$collection[] = $localMedia;
|
$collection[] = $localMedia;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user