Skip to content

Commit 02f56f8

Browse files
committed
Update FireFS::makePath()
1 parent 1c6f3e3 commit 02f56f8

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/FireFS/FireFS.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public function toInternalPath(string $path): string
277277

278278
// Convert relative path to absolute path
279279
if (preg_match('#^(\.)+/#', $internalPath)) {
280-
$internalPath = $this->makePath(array($this->workingDir(), $internalPath));
280+
$internalPath = $this->makePath($this->workingDir(), $internalPath);
281281
}
282282

283283
// Apply aliases
@@ -288,7 +288,7 @@ public function toInternalPath(string $path): string
288288

289289
foreach ($this->aliases as $key => $value) {
290290
if (substr($internalPath, 0, strlen($key)) == $key) {
291-
$internalPath = $this->makePath(array($value, substr($internalPath, strlen($key))));
291+
$internalPath = $this->makePath($value, substr($internalPath, strlen($key)));
292292
$appliedAliasesNbr++;
293293
}
294294
}
@@ -299,7 +299,7 @@ public function toInternalPath(string $path): string
299299
// Prepend the root path
300300
$rootPath = $this->rootPath();
301301
if (!empty($rootPath)) {
302-
$internalPath = $this->makePath(array($rootPath, $internalPath));
302+
$internalPath = $this->makePath($rootPath, $internalPath);
303303
}
304304

305305
return $this->cleanPath($internalPath);
@@ -318,10 +318,10 @@ public function rootPath(): string
318318
/**
319319
* Implode all parts of $path and return a valid path
320320
*
321-
* @param array $path Parts of the path to build
321+
* @param string[] $path Parts of the path to build
322322
* @return string
323323
*/
324-
public function makePath(array $path): string
324+
public function makePath(string ...$path): string
325325
{
326326
return implode(DIRECTORY_SEPARATOR, array_map(function ($field) {
327327
return rtrim($field, '/\\');
@@ -573,7 +573,7 @@ public function mkdir(string $path, bool $recursive = false): bool
573573
*/
574574
public function rename(string $path, string $new_name): bool
575575
{
576-
return $this->move($path, $this->makePath(array($this->dirname($path), $new_name)));
576+
return $this->move($path, $this->makePath($this->dirname($path), $new_name));
577577
}
578578

579579
/**
@@ -589,7 +589,7 @@ public function rename(string $path, string $new_name): bool
589589
public function move(string $path, string $new_path): bool
590590
{
591591
if ($this->isDir($new_path) && !$this->isDir($path)) {
592-
$new_path = $this->makePath(array($new_path, $this->basename($path)));
592+
$new_path = $this->makePath($new_path, $this->basename($path));
593593
}
594594

595595
$destDirname = $this->dirname($new_path);
@@ -633,7 +633,7 @@ public function basename(string $path): string
633633
public function copy(string $path, string $new_path): bool
634634
{
635635
if ($this->isDir($new_path) && !$this->isDir($path)) {
636-
$new_path = $this->cleanPath($this->makePath(array($new_path, $this->basename($path))));
636+
$new_path = $this->cleanPath($this->makePath($new_path, $this->basename($path)));
637637
}
638638

639639
$destDirname = $this->dirname($new_path);
@@ -655,7 +655,7 @@ public function copy(string $path, string $new_path): bool
655655
$res = false;
656656

657657
foreach ($subfiles as $fileToCopyName => $fileToCopyPath) {
658-
$res = $this->copy($this->makePath(array($path, $fileToCopyName)), $this->makePath(array($new_path, $fileToCopyName)));
658+
$res = $this->copy($this->makePath($path, $fileToCopyName), $this->makePath($new_path, $fileToCopyName));
659659

660660
if (!$res)
661661
break;
@@ -698,7 +698,7 @@ public function readDir(string $path, bool $recursive = false, array $options =
698698

699699
if ($handle = opendir($path)) {
700700
while (($file = readdir($handle)) !== false) {
701-
$filepath = $this->cleanPath($this->makePath(array($path, $file)));
701+
$filepath = $this->cleanPath($this->makePath($path, $file));
702702

703703
// Removing dirty
704704
if ($file == '.' || $file == '..') {
@@ -741,7 +741,7 @@ public function readDir(string $path, bool $recursive = false, array $options =
741741
if ($recursive === true && $this->isDir($filepath)) {
742742
$subfiles = $this->readDir($filepath, $recursive, $options);
743743
foreach ($subfiles as $subfilename => $subfilepath) {
744-
$files[$this->makePath(array($file, $subfilename))] = $subfilepath;
744+
$files[$this->makePath($file, $subfilename)] = $subfilepath;
745745
}
746746
}
747747
}
@@ -803,7 +803,7 @@ public function toExternalPath(string $internalPath): string
803803
foreach ($this->aliases as $key => $value) {
804804
$value = '/' . $value;
805805
if (substr($externalPath, 0, strlen($value)) == $value) {
806-
$externalPath = $this->makePath(array($key, substr($externalPath, strlen($value))));
806+
$externalPath = $this->makePath($key, substr($externalPath, strlen($value)));
807807
$appliedAliasesNbr++;
808808
}
809809
}
@@ -847,7 +847,7 @@ public function toFileSystemPath(string $internalPath): string
847847

848848
foreach ($this->aliases as $key => $value) {
849849
if (substr($externalPath, 0, strlen($key)) == $key) {
850-
$externalPath = $this->makePath(array($value, substr($externalPath, strlen($key))));
850+
$externalPath = $this->makePath($value, substr($externalPath, strlen($key)));
851851
$appliedAliasesNbr++;
852852
}
853853
}

0 commit comments

Comments
 (0)