TagCollectionBuilder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 30
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addTags() 0 8 2
A createTagCollection() 0 11 1
A getTags() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Builders;
6
7
use Aweapi\Openapi\Objects;
8
9
final class TagCollectionBuilder implements Objects\TagCollectionFactory
10
{
11
    private $tags = [];
12
13 2
    public function addTags(Objects\TagFactory ...$tags): self
14
    {
15 2
        foreach ($tags as $tag) {
16 2
            $this->tags[] = $tag;
17
        }
18
19 2
        return $this;
20
    }
21
22 2
    public function createTagCollection(): Objects\TagCollection
23
    {
24 2
        return new Objects\TagCollection(
25 2
            array_map(
26
                static function (Objects\TagFactory $factory): Objects\Tag {
27 2
                    return $factory->createTag();
28 2
                },
29 2
                $this->getTags()
30
            )
31
        );
32
    }
33
34 2
    private function getTags(): array
35
    {
36 2
        return $this->tags;
37
    }
38
}
39