File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1010class 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 /**
Original file line number Diff line number Diff 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])
You can’t perform that action at this time.
0 commit comments