| Conditions | 5 |
| Paths | 6 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | 3 | public function run(Filesystem $fs) |
|
| 11 | { |
||
| 12 | $version = [ |
||
| 13 | 3 | 'service' => null, |
|
| 14 | 'php' => PHP_VERSION, |
||
| 15 | ]; |
||
| 16 | 3 | ||
| 17 | 3 | if (file_exists($fs->getPath('version.php'))) { |
|
| 18 | 1 | $git = include $fs->getPath('version.php'); |
|
| 19 | 1 | $version['service'] = $git['tag'] ?: $git['short_sha']; |
|
| 20 | 1 | } |
|
| 21 | |||
| 22 | $lock = $fs->getPath('composer.lock'); |
||
| 23 | if (is_file($lock)) { |
||
| 24 | 3 | $info = json_decode(file_get_contents($lock)); |
|
| 25 | foreach ($info->packages as $package) { |
||
| 26 | $version[$package->name] = $package->version; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | return compact('version'); |
||
| 31 | } |
||
| 32 | } |
||
| 33 |