| 1 | <?php |
||
| 16 | class BinaryPhp extends Binary |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var string package full name, e.g. fabpot/php-cs-fixer |
||
| 20 | */ |
||
| 21 | public $package; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string package version constraint, e.g. ^1.1 |
||
| 25 | */ |
||
| 26 | public $version; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var string installer URL |
||
| 30 | */ |
||
| 31 | public $installer; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string URL to download PHAR |
||
| 35 | */ |
||
| 36 | public $phar_url; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Detects how to run the binary. |
||
| 40 | * Searches in this order: |
||
| 41 | * 1. name.phar in project root directory |
||
| 42 | * 2. ./vendor/bin/name |
||
| 43 | * 3. $HOME/.composer/vendor/bin/name. |
||
| 44 | * |
||
| 45 | * @param string $name |
||
| 46 | * @return string path to the binary |
||
| 47 | */ |
||
| 48 | public function detectPath($name) |
||
| 59 | |||
| 60 | public function detectCommand($path) |
||
| 66 | } |
||
| 67 |
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: