SecurityRequirement   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 34
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A getItems() 0 4 1
A normalizeRequiredProperties() 0 4 1
A setItem() 0 9 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