Completed
Push — master ( 7c9e2e...904e9e )
by Dmitry
11:28 queued 05:32
created

Version::run()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 9.4285
cc 3
eloc 9
nc 2
nop 1
crap 3
1
<?php
2
3
namespace Basis\Job\Module;
4
5
use Basis\Filesystem;
6
use Basis\Job;
7
8
class Version extends Job
9
{
10 1
    public function run(Filesystem $fs)
11
    {
12
        $version = [
13 1
            'php' => PHP_VERSION
14
        ];
15
16 1
        $lock = $fs->getPath('composer.lock');
17 1
        if (is_file($lock)) {
18 1
            $info = json_decode(file_get_contents($lock));
19 1
            foreach ($info->packages as $package) {
20 1
                $version[$package->name] = $package->version;
21
            }
22
        }
23
24 1
        return compact('version');
25
    }
26
}
27