1 | <?php |
||
16 | class BinaryPhp extends Binary |
||
17 | { |
||
18 | /** |
||
19 | * Detects how to run the binary. |
||
20 | * Searches in this order: |
||
21 | * 1. PHAR in project's root directory |
||
22 | * 2. projects's vendor/bin directory |
||
23 | * 3. composer global vendor/bin directory. |
||
24 | * |
||
25 | * @param string $name |
||
26 | * @return string path to the binary |
||
27 | */ |
||
28 | public function detectPath($name) |
||
39 | |||
40 | /** |
||
41 | * Detect command execution string. |
||
42 | * @param mixed $path |
||
43 | * @return string |
||
44 | */ |
||
45 | public function detectCommand($path) |
||
51 | |||
52 | public function install() |
||
65 | |||
66 | public function getVcsignore() |
||
70 | } |
||
71 |
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: