mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 23:42:34 +00:00
Add phpstan level 7(#544)
This commit is contained in:
@ -9,10 +9,14 @@ private function prepareS3Path(string $path, string $prefix = ''): string
|
||||
$path = trim($path);
|
||||
$path = ltrim($path, '/');
|
||||
$path = preg_replace('/[^a-zA-Z0-9\-_\.\/]/', '_', $path);
|
||||
$path = preg_replace('/\/+/', '/', $path);
|
||||
$path = preg_replace('/\/+/', '/', (string) $path);
|
||||
|
||||
if ($prefix) {
|
||||
$path = trim($prefix, '/').'/'.$path;
|
||||
if ($prefix !== '' && $prefix !== '0') {
|
||||
return trim($prefix, '/').'/'.$path;
|
||||
}
|
||||
|
||||
if ($path === null) {
|
||||
throw new \Exception('Invalid S3 path');
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
Reference in New Issue
Block a user