| Total Complexity | 7 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class Binaries extends \hidev\base\Component |
||
| 16 | { |
||
| 17 | use \hiqdev\yii2\collection\ManagerTrait; |
||
| 18 | |||
| 19 | public $defaultClass = BinaryPhp::class; |
||
| 20 | |||
| 21 | public function actionMake() |
||
| 22 | { |
||
| 23 | foreach ($this->getItems() as $name => $bin) { |
||
| 24 | if (!$bin->detectPath($name)) { |
||
| 25 | $exitcode = $bin->install(); |
||
| 26 | if ($exitcode) { |
||
| 27 | return $exitcode; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Prepares item config. |
||
| 35 | */ |
||
| 36 | public function getItemConfig($name = null, array $config = []) |
||
| 37 | { |
||
| 38 | return array_merge([ |
||
| 39 | 'name' => $name, |
||
| 40 | 'class' => $this->defaultClass, |
||
| 41 | 'binaries' => $this, |
||
| 42 | ], $config); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Prepares and runs with passthru. Returns exit code. |
||
| 47 | * @param string $name binary |
||
| 48 | * @param array|string $args |
||
| 49 | * @return int exit code |
||
| 50 | */ |
||
| 51 | public function passthruBinary($name, $args = []) |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Prepares and runs with exec. Returns stdout string. |
||
| 58 | * @param string $name binary |
||
| 59 | * @param string $args |
||
| 60 | * @return array stdout |
||
| 61 | */ |
||
| 62 | public function execBinary($name, $args = '', $returnExitCode = false) |
||
| 65 | } |
||
| 66 | } |
||
| 67 |