1 | <?php |
||
16 | class PathBuilder |
||
17 | { |
||
18 | private $namespace; |
||
19 | private $path; |
||
20 | |||
21 | /** |
||
22 | * Constructor |
||
23 | * Take in the path & the psr4 namespace it represents |
||
24 | * |
||
25 | * @param string $path absolute path |
||
26 | * @param Psr4Namespace $namespace namespace that represents the provided |
||
27 | * path |
||
28 | */ |
||
29 | public function __construct(string $path, Psr4Namespace $namespace) |
||
37 | |||
38 | /** |
||
39 | * Get the absolute directory of the provided namespace, relative to the initial |
||
40 | * path/namespace |
||
41 | * |
||
42 | * @param Psr4Namespace $namespace The namespace you want the directory for |
||
43 | * @return string the absolute directory path, empty if it does not exist! |
||
44 | */ |
||
45 | public function resolve(Psr4Namespace $namespace): string |
||
60 | |||
61 | /** |
||
62 | * Convert a namespace to a path equivilent. |
||
63 | * |
||
64 | * @param string $namespace |
||
65 | * @return string |
||
66 | */ |
||
67 | private function nsToPath(string $namespace): string |
||
74 | } |
||
75 |