| 1 | <?php |
||
| 7 | trait Directories |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @return string |
||
| 11 | */ |
||
| 12 | public function getBaseDirectory() |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param Repository $repository |
||
| 19 | * |
||
| 20 | * @return string |
||
| 21 | */ |
||
| 22 | public function getRepositoryDirectory(Repository $repository) |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param Repository $repository |
||
| 29 | * @param string $version |
||
| 30 | * |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | public function getPharDirectory(Repository $repository, $version) |
||
| 37 | } |
||
| 38 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: