Completed
Pull Request — master (#6)
by Veaceslav
02:38 queued 01:30
created

TagBuilder   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 3
dl 0
loc 56
ccs 21
cts 21
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A createTag() 0 9 2
A setDescription() 0 6 1
A setExternalDocs() 0 6 1
A setName() 0 6 1
A getDescription() 0 4 1
A getExternalDocs() 0 4 1
A getName() 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 TagBuilder implements Objects\TagFactory
10
{
11
    use Properties\OptionalExtensions;
12
13
    private $description;
14
15
    private $externalDocs;
16
17
    private $name;
18
19 4
    public function createTag(): Objects\Tag
20
    {
21 4
        return new Objects\Tag(
22 4
            $this->getName(),
23 4
            $this->getDescription(),
24 4
            $this->getExternalDocs() ? $this->getExternalDocs()->createExternalDocumentation() : null,
25 4
            $this->getExtensions()
26
        );
27
    }
28
29 1
    public function setDescription(string $description): self
30
    {
31 1
        $this->description = $description;
32
33 1
        return $this;
34
    }
35
36 1
    public function setExternalDocs(Objects\ExternalDocumentationFactory $externalDocs): self
37
    {
38 1
        $this->externalDocs = $externalDocs;
39
40 1
        return $this;
41
    }
42
43 4
    public function setName(string $name): self
44
    {
45 4
        $this->name = $name;
46
47 4
        return $this;
48
    }
49
50 4
    private function getDescription(): ?string
51
    {
52 4
        return $this->description;
53
    }
54
55 4
    private function getExternalDocs(): ?Objects\ExternalDocumentationFactory
56
    {
57 4
        return $this->externalDocs;
58
    }
59
60 4
    private function getName(): string
61
    {
62 4
        return $this->name;
63
    }
64
}
65