Skip to content

Commit d0ba6dd

Browse files
committed
Add pub and pri dir support
1 parent a23593c commit d0ba6dd

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Dir.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
class Dir implements DirInterface
1111
{
1212
private $dir;
13+
private $getRootDir;
1314
private $handler;
1415

1516

16-
public function __construct($dir)
17+
public function __construct($dir, ?string $getRootDir = null)
1718
{
1819
$this->dir = $dir;
20+
$this->getRootDir = $getRootDir;
1921
}
2022

2123
/**
@@ -45,7 +47,7 @@ public function getDir(string $path = ""): string
4547
*/
4648
public function getRoot(string $path = ""): string
4749
{
48-
return $this->getDir("../" . $path);
50+
return $this->getRootDir.$path;
4951
}
5052

5153
/**

Uri.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Uri implements UriInterface
3434
private $query;
3535
private $fragment; // Anchor/after hash
3636
private $dir;
37+
private $rootDir;
3738
private $userInfo;
3839
private $authority;
3940
private $argv;
@@ -67,6 +68,7 @@ protected function pollyfill()
6768
$this->query = "";
6869
$this->fragment = "";
6970
$this->dir = "";
71+
$this->rootDir = "";
7072
}
7173

7274
/**
@@ -102,6 +104,18 @@ public function getDir(): string
102104
return (string)$this->encoded['dir'];
103105
}
104106

107+
/**
108+
* Get dir
109+
* @return string (ex: http/https)
110+
*/
111+
public function getRootDir(): string
112+
{
113+
if ($val = $this->getUniquePart("rootDir")) {
114+
$this->encoded['rootDir'] = $val;
115+
}
116+
return (string)$this->encoded['rootDir'];
117+
}
118+
105119
/**
106120
* Get authority
107121
* @return string (ex: [userInfo@]host[:port])

0 commit comments

Comments
 (0)