Completed
Push — master ( 00d376...cc54a0 )
by Veaceslav
01:15
created

ServerVariableBuilder::setDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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 ServerVariableBuilder implements Objects\ServerVariableFactory
10
{
11
    use Properties\OptionalExtensions;
12
13
    private $default;
14
15
    private $description;
16
17
    private $enum;
18
19 4
    public function createServerVariable(): Objects\ServerVariable
20
    {
21 4
        return new Objects\ServerVariable(
22 4
            $this->isDefault(),
23 4
            $this->getEnum(),
24 4
            $this->getDescription(),
25 4
            $this->getExtensions()
26
        );
27
    }
28
29 4
    public function setDefault(bool $default): self
30
    {
31 4
        $this->default = $default;
32
33 4
        return $this;
34
    }
35
36 1
    public function setDescription(string $description): self
37
    {
38 1
        $this->description = $description;
39
40 1
        return $this;
41
    }
42
43 1
    public function setEnum(array $enum): self
44
    {
45 1
        $this->enum = $enum;
46
47 1
        return $this;
48
    }
49
50 4
    private function getDescription(): ?string
51
    {
52 4
        return $this->description;
53
    }
54
55 4
    private function getEnum(): ?array
56
    {
57 4
        return $this->enum;
58
    }
59
60 4
    private function isDefault(): bool
61
    {
62 4
        return $this->default;
63
    }
64
}
65