CallbackRequest::setItem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Objects;
6
7
use Aweapi\Openapi\Extensions;
8
use Aweapi\Openapi\Map;
9
10
final class CallbackRequest extends Map
11
{
12
    use Properties\OptionalExtensions;
13
14
    private $items = [];
15
16 10
    public function __construct(
17
        iterable $items,
18
        Extensions $extensions = null
19
    ) {
20 10
        foreach ($items as $expression => $path) {
21 8
            $this->setItem($expression, $path);
22
        }
23
24 10
        $this->extensions = $extensions;
25
    }
26
27
    /**
28
     * @return array<string, Path>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
29
     */
30 9
    public function getItems(): array
31
    {
32 9
        return $this->items;
33
    }
34
35 9
    public function jsonSerialize(): ?array
36
    {
37 9
        return $this->extendedProperties(parent::jsonSerialize());
38
    }
39
40 8
    private function setItem(string $expression, Path $path): void
41
    {
42 8
        $this->items[$expression] = $path;
43
    }
44
}
45