| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 48 | public function detectPath($name) |
||
|
|
|||
| 49 | { |
||
| 50 | $paths = [Yii::getAlias("@prjdir/$name.phar"), Yii::getAlias("@prjdir/vendor/bin/$name"), "$_SERVER[HOME]/.composer/vendor/bin/$name"]; |
||
| 51 | foreach ($paths as $path) { |
||
| 52 | if (file_exists($path)) { |
||
| 53 | return $path; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | return parent::detectPath($name); |
||
| 58 | } |
||
| 59 | |||
| 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: