Passed
Push — master ( 1d1b3b...024fd5 )
by Pol
02:36
created

Packages   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 24
ccs 11
cts 11
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A exportToArray() 0 19 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\ComposerPackages\Exporter;
6
7
class Packages extends Exporter
8
{
9
    /**
10
     * @return array
11
     */
12 2
    public function exportToArray(): array
13
    {
14 2
        $data = $this->getEvent()->getComposer()->getLocker()->getLockData();
15
16 2
        $packagesData = array_merge(
17 2
            $data['packages'],
18 2
            $data['packages-dev']
19
        );
20
21 2
        $packageNames = array_map(
22
            static function (array $data) {
23 2
                return $data['name'];
24 2
            },
25 2
            $packagesData
26
        );
27
28 2
        $packages = array_combine($packageNames, $packagesData);
29
30 2
        return compact('packages');
31
    }
32
}
33