Extensions   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 25
ccs 9
cts 12
cp 0.75
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getKeyValuePairs() 0 8 1
A getListOfExtensions() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PascalDeVink\CloudEvents\V03;
6
7
use PascalDeVink\CloudEvents\Extension\Extension;
8
9
class Extensions
10
{
11
    private array $listOfExtensions;
12
13 3
    public function __construct(Extension ...$listOfExtensions)
14
    {
15 3
        $this->listOfExtensions = $listOfExtensions;
16 3
    }
17
18
    /**
19
     * @return Extension[]
20
     */
21
    public function getListOfExtensions() : array
22
    {
23
        return $this->listOfExtensions;
24
    }
25
26 3
    public function getKeyValuePairs() : array
27
    {
28 3
        return array_merge(
29
            ...array_map(
30 1
                function (Extension $extension) : array {
31 3
                        return $extension->toArray();
32 3
                },
33 3
                $this->listOfExtensions
34
            )
35
        );
36
    }
37
}
38