Extensions::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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