| 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 | * @param string $path [description] |
||
| 25 | * @param Psr4Namespace $namespace [description] |
||
| 26 | */ |
||
| 27 | public function __construct(string $path, Psr4Namespace $namespace) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Get the absolute directory of the provided namespace, relative to the initial |
||
| 38 | * path/namespace |
||
| 39 | * |
||
| 40 | * @param Psr4Namespace $namespace The namespace you want the directory for |
||
| 41 | * @return string the absolute directory path, empty if it does not exist! |
||
| 42 | */ |
||
| 43 | public function resolve(Psr4Namespace $namespace): string |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Convert a namespace to a path equivilent. |
||
| 58 | * |
||
| 59 | * @param string $namespace |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | private function nsToPath(string $namespace): string |
||
| 69 | } |
||
| 70 |