Skip to content

Commit 5fae927

Browse files
committed
new: add new class Path
1 parent bea2984 commit 5fae927

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/FileSystem.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use function is_file;
2727
use function is_string;
2828
use function preg_match;
29+
use function str_ends_with;
2930
use function str_ireplace;
3031
use function strlen;
3132
use function strpos;
@@ -129,6 +130,10 @@ public static function joinPath(string $basePath, string ...$subPaths): string
129130
return $basePath;
130131
}
131132

133+
if (str_ends_with($basePath, '/')) {
134+
$basePath = substr($basePath, 0, -1);
135+
}
136+
132137
return $basePath . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $subPaths);
133138
}
134139

src/Path.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Toolkit\FsUtil;
4+
5+
/**
6+
* Class Path
7+
*
8+
* @package Toolkit\FsUtil
9+
*/
10+
class Path extends FileSystem
11+
{
12+
13+
}

0 commit comments

Comments
 (0)