refactor(StorageService): change remove methods to return bool
This commit is contained in:
parent
b56f43b5c8
commit
08fda2cdfd
3 changed files with 10 additions and 8 deletions
|
|
@ -31,7 +31,7 @@ interface StorageService
|
|||
|
||||
public function getFile(StorageFilePath $filePath): ?FileStream;
|
||||
|
||||
public function remove(StorageFilePath $filePath): void;
|
||||
public function remove(StorageFilePath $filePath): bool;
|
||||
|
||||
public function removeFromDisk(StorageFilePath $filePath, DiskName $disk): void;
|
||||
public function removeFromDisk(StorageFilePath $filePath, DiskName $disk): bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ use Uwil\Storage\Contracts\StorageService as StorageServiceContract;
|
|||
* @method static bool fileExists(\Uwil\Storage\Lib\ValueObjects\StorageFilePath $filePath)
|
||||
* @method static bool fileExistsOnDisk(\Uwil\Storage\Lib\ValueObjects\StorageFilePath $filePath, \Uwil\Storage\Lib\ValueObjects\DiskName $disk)
|
||||
* @method static \Uwil\Storage\Lib\ValueObjects\FileStream|null getFile(\Uwil\Storage\Lib\ValueObjects\StorageFilePath $filePath)
|
||||
* @method static void remove(\Uwil\Storage\Lib\ValueObjects\StorageFilePath $filePath)
|
||||
* @method static void removeFromDisk(\Uwil\Storage\Lib\ValueObjects\StorageFilePath $filePath, \Uwil\Storage\Lib\ValueObjects\DiskName $disk)
|
||||
* @method static bool remove(\Uwil\Storage\Lib\ValueObjects\StorageFilePath $filePath)
|
||||
* @method static bool removeFromDisk(\Uwil\Storage\Lib\ValueObjects\StorageFilePath $filePath, \Uwil\Storage\Lib\ValueObjects\DiskName $disk)
|
||||
*
|
||||
* @see \Uwil\Storage\Contracts\StorageService
|
||||
* @see \Uwil\Storage\Lib\StorageServiceImpl
|
||||
|
|
|
|||
|
|
@ -83,16 +83,18 @@ readonly class StorageServiceImpl implements StorageService
|
|||
}
|
||||
|
||||
#[\Override]
|
||||
public function remove(StorageFilePath $filePath): void
|
||||
|
||||
#[\Override]
|
||||
public function remove(StorageFilePath $filePath): bool
|
||||
{
|
||||
$defaultDisk = $this->config->getDefaultDisk();
|
||||
|
||||
$this->gateway->deleteFile($defaultDisk, $filePath);
|
||||
return $this->gateway->deleteFile($defaultDisk, $filePath);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function removeFromDisk(StorageFilePath $filePath, DiskName $disk): void
|
||||
public function removeFromDisk(StorageFilePath $filePath, DiskName $disk): bool
|
||||
{
|
||||
$this->gateway->deleteFile($disk, $filePath);
|
||||
return $this->gateway->deleteFile($disk, $filePath);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue