File tree Expand file tree Collapse file tree 2 files changed +3
-112
lines changed Expand file tree Collapse file tree 2 files changed +3
-112
lines changed Original file line number Diff line number Diff line change @@ -6,36 +6,16 @@ class SimpleRelativePathHelper implements RelativePathHelper
6
6
{
7
7
8
8
/** @var string */
9
- private $ directorySeparator ;
9
+ private $ currentWorkingDirectory ;
10
10
11
- /** @var string */
12
- private $ currentWorkingDirectory = '' ;
13
-
14
- public function __construct (string $ currentWorkingDirectory , string $ directorySeparator = DIRECTORY_SEPARATOR )
11
+ public function __construct (string $ currentWorkingDirectory )
15
12
{
16
- $ this ->directorySeparator = $ directorySeparator ;
17
-
18
- if ($ currentWorkingDirectory !== $ directorySeparator ) {
19
- $ currentWorkingDirectory = rtrim ($ currentWorkingDirectory , $ directorySeparator );
20
- }
21
13
$ this ->currentWorkingDirectory = $ currentWorkingDirectory ;
22
14
}
23
15
24
16
public function getRelativePath (string $ filename ): string
25
17
{
26
- if ($ this ->currentWorkingDirectory === '' ) {
27
- return $ filename ;
28
- }
29
-
30
- if ($ this ->currentWorkingDirectory === $ this ->directorySeparator ) {
31
- if (strpos ($ filename , $ this ->currentWorkingDirectory ) === 0 ) {
32
- return substr ($ filename , strlen ($ this ->currentWorkingDirectory ));
33
- }
34
-
35
- return $ filename ;
36
- }
37
-
38
- if (strpos ($ filename , $ this ->currentWorkingDirectory . $ this ->directorySeparator ) === 0 ) {
18
+ if ($ this ->currentWorkingDirectory !== '' && strpos ($ filename , $ this ->currentWorkingDirectory ) === 0 ) {
39
19
return substr ($ filename , strlen ($ this ->currentWorkingDirectory ) + 1 );
40
20
}
41
21
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments