Completed
Pull Request — master (#6)
by Veaceslav
11:19
created

InfoBuilder::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Aweapi\Openapi\Builders;
6
7
use Aweapi\Openapi\Objects;
8
9
final class InfoBuilder implements Objects\InfoFactory
10
{
11
    use Properties\OptionalExtensions;
12
13
    private $contact;
14
15
    private $description;
16
17
    private $license;
18
19
    private $termsOfService;
20
21
    private $title;
22
23
    private $version;
24
25
    public function createInfo(): Objects\Info
26
    {
27
        return new Objects\Info(
28
            $this->getTitle(),
29
            $this->getVersion(),
30
            $this->getDescription(),
31
            $this->getTermsOfService(),
32
            $this->getContact() ? $this->getContact()->createContact() : null,
33
            $this->getLicense() ? $this->getLicense()->createLicense() : null,
34
            $this->getExtensions()
35
        );
36
    }
37
38
    public function setContact(Objects\ContactFactory $contact): self
39
    {
40
        $this->contact = $contact;
41
42
        return $this;
43
    }
44
45
    public function setDescription(string $description): self
46
    {
47
        $this->description = $description;
48
49
        return $this;
50
    }
51
52
    public function setLicense(Objects\LicenseFactory $license): self
53
    {
54
        $this->license = $license;
55
56
        return $this;
57
    }
58
59
    public function setTermsOfService(string $termsOfService): self
60
    {
61
        $this->termsOfService = $termsOfService;
62
63
        return $this;
64
    }
65
66
    public function setTitle(string $title): self
67
    {
68
        $this->title = $title;
69
70
        return $this;
71
    }
72
73
    public function setVersion(string $version): self
74
    {
75
        $this->version = $version;
76
77
        return $this;
78
    }
79
80
    private function getContact(): ?Objects\ContactFactory
81
    {
82
        return $this->contact;
83
    }
84
85
    private function getDescription(): ?string
86
    {
87
        return $this->description;
88
    }
89
90
    private function getLicense(): ?Objects\LicenseFactory
91
    {
92
        return $this->license;
93
    }
94
95
    private function getTermsOfService(): ?string
96
    {
97
        return $this->termsOfService;
98
    }
99
100
    private function getTitle(): string
101
    {
102
        return $this->title;
103
    }
104
105
    private function getVersion(): string
106
    {
107
        return $this->version;
108
    }
109
}
110