| Conditions | 3 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.0884 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | 2 | public function execute() |
|
| 40 | { |
||
| 41 | 2 | $cmd = $this->nodeVersionCommand; |
|
| 42 | 2 | $command = new Commands\Exec(); |
|
| 43 | 2 | $command->setCommand($cmd); |
|
| 44 | 2 | $result = $command->execute(); |
|
| 45 | 2 | if ($result->getResult() !== 0) { |
|
| 46 | $this->error(sprintf('Execution of command "%s" failed.', $cmd)); |
||
| 47 | } |
||
| 48 | |||
| 49 | 2 | $version = $result->getOutput()[0]; |
|
| 50 | 2 | if (version_compare($version, $this->requiredVersion) < 0) { |
|
| 51 | 1 | $this->error(sprintf('Node.JS is not current. Version %s required, but %s is installed.', $this->requiredVersion, $version)); |
|
| 52 | } |
||
| 53 | |||
| 54 | 1 | $this->log(sprintf('Required Node.JS version %s satisfied with installed version %s.', $this->requiredVersion, $version)); |
|
| 55 | 1 | } |
|
| 56 | |||
| 58 |