1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 14:46:53 +02:00

refactor(media): code cleanup

This commit is contained in:
Awilum
2020-07-27 17:57:13 +03:00
parent 28e9564e42
commit 999a97636a
2 changed files with 7 additions and 20 deletions

View File

@@ -269,7 +269,6 @@ class MediaFiles
$result = [];
if (Filesystem::has($this->flextype['media_files_meta']->getFileMetaLocation($path))) {
$result = $this->flextype['yaml']->decode(Filesystem::read($this->flextype['media_files_meta']->getFileMetaLocation($path)));
$result['filename'] = pathinfo(str_replace('/.meta', '', $this->flextype['media_files_meta']->getFileMetaLocation($path)))['filename'];
@@ -354,12 +353,8 @@ class MediaFiles
*/
public function delete(string $id) : bool
{
if (Filesystem::delete($this->getFileLocation($id)) &&
Filesystem::delete($this->flextype['media_files_meta']->getFileMetaLocation($id))) {
return true;
}
return false;
return Filesystem::delete($this->getFileLocation($id)) &&
Filesystem::delete($this->flextype['media_files_meta']->getFileMetaLocation($id));
}
/**
@@ -373,12 +368,8 @@ class MediaFiles
*/
public function has(string $id) : bool
{
if (Filesystem::has($this->getFileLocation($id)) &&
Filesystem::has($this->flextype['media_files_meta']->getFileMetaLocation($id))) {
return true;
}
return false;
return Filesystem::has($this->getFileLocation($id)) &&
Filesystem::has($this->flextype['media_files_meta']->getFileMetaLocation($id));
}
/**

View File

@@ -37,7 +37,7 @@ class MediaFolders
/**
* Fetch folders(s)
*
* @param string $path The path of directory to list.
* @param string $path The path of directory to list.
* @param bool $collection Set `true` if collection of folders need to be fetched.
*
* @return array A list of file(s) metadata.
@@ -149,12 +149,8 @@ class MediaFolders
*/
public function delete(string $id) : bool
{
if (Filesystem::deleteDir($this->getDirLocation($id)) &&
Filesystem::deleteDir($this->flextype['media_folders_meta']->getDirMetaLocation($id))) {
return true;
}
return false;
return Filesystem::deleteDir($this->getDirLocation($id)) &&
Filesystem::deleteDir($this->flextype['media_folders_meta']->getDirMetaLocation($id));
}
/**