SecurityRequirement::normalizeRequiredProperties()   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 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Objects;
6
7
use Aweapi\Openapi\ValueObject;
8
9
final class SecurityRequirement extends ValueObject
10
{
11
    private $items = [];
12
13 10
    public function __construct(iterable $requirements)
14
    {
15 10
        foreach ($requirements as $name => $requirement) {
16 8
            $this->setItem($name, $requirement);
17
        }
18
    }
19
20
    /**
21
     * @return array<string, array>
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...
22
     */
23 10
    public function getItems(): array
24
    {
25 10
        return $this->items;
26
    }
27
28 10
    protected function normalizeRequiredProperties(): array
29
    {
30 10
        return $this->getItems();
31
    }
32
33 8
    private function setItem(string $name, array $requirement): void
34
    {
35 8
        $this->items[$name] = array_map(
36
            function (string $scope): string {
37 8
                return $scope;
38 8
            },
39
            $requirement
40
        );
41
    }
42
}
43