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

LinkBuilder::setOperationRef()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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 LinkBuilder implements Objects\LinkFactory
10
{
11
    use Properties\OptionalExtensions;
12
13
    private $description;
14
15
    private $operationId;
16
17
    private $operationRef;
18
19
    private $parameters = [];
20
21
    private $requestBody;
22
23
    private $server;
24
25
    public function createLink(): Objects\Link
26
    {
27
        return new Objects\Link(
28
            $this->getOperationId(),
29
            $this->getOperationRef(),
30
            $this->getDescription(),
31
            $this->getParameters(),
32
            $this->getRequestBody(),
33
            $this->getServer() ? $this->getServer()->createServer() : null,
34
            $this->getExtensions()
35
        );
36
    }
37
38
    public function setDescription(string $description): self
39
    {
40
        $this->description = $description;
41
42
        return $this;
43
    }
44
45
    public function setOperationId(string $operationId): self
46
    {
47
        $this->operationId = $operationId;
48
49
        return $this;
50
    }
51
52
    public function setOperationRef(string $operationRef): self
53
    {
54
        $this->operationRef = $operationRef;
55
56
        return $this;
57
    }
58
59
    public function setParameters(array $parameters): self
60
    {
61
        $this->parameters = $parameters;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @param mixed $requestBody
68
     */
69
    public function setRequestBody($requestBody): self
70
    {
71
        $this->requestBody = $requestBody;
72
73
        return $this;
74
    }
75
76
    public function setServer(Objects\ServerFactory $server): self
77
    {
78
        $this->server = $server;
79
80
        return $this;
81
    }
82
83
    private function getDescription(): ?string
84
    {
85
        return $this->description;
86
    }
87
88
    private function getOperationId(): ?string
89
    {
90
        return $this->operationId;
91
    }
92
93
    private function getOperationRef(): ?string
94
    {
95
        return $this->operationRef;
96
    }
97
98
    private function getParameters(): array
99
    {
100
        return $this->parameters;
101
    }
102
103
    /**
104
     * @return mixed
105
     */
106
    private function getRequestBody()
107
    {
108
        return $this->requestBody;
109
    }
110
111
    private function getServer(): ?Objects\ServerFactory
112
    {
113
        return $this->server;
114
    }
115
}
116