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

EncodingBuilder::setAllowReserved()   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 EncodingBuilder implements Objects\EncodingFactory
10
{
11
    use Properties\OptionalExtensions;
12
13
    private $allowReserved = false;
14
15
    private $contentType;
16
17
    private $explode = true;
18
19
    private $headers;
20
21
    private $style;
22
23 4
    public function createEncoding(): Objects\Encoding
24
    {
25 4
        return new Objects\Encoding(
26 4
            $this->getContentType(),
27 4
            $this->getHeaders() ? $this->getHeaders()->createHeaders() : null,
28 4
            $this->getStyle(),
29 4
            $this->isExplode(),
30 4
            $this->isAllowReserved(),
31 4
            $this->getExtensions()
32
        );
33
    }
34
35 1
    public function setAllowReserved(bool $allowReserved): self
36
    {
37 1
        $this->allowReserved = $allowReserved;
38
39 1
        return $this;
40
    }
41
42 3
    public function setContentType(string $contentType): self
43
    {
44 3
        $this->contentType = $contentType;
45
46 3
        return $this;
47
    }
48
49 1
    public function setExplode(bool $explode): self
50
    {
51 1
        $this->explode = $explode;
52
53 1
        return $this;
54
    }
55
56 1
    public function setHeaders(Objects\HeadersFactory $headers): self
57
    {
58 1
        $this->headers = $headers;
59
60 1
        return $this;
61
    }
62
63 1
    public function setStyle(string $style): self
64
    {
65 1
        $this->style = $style;
66
67 1
        return $this;
68
    }
69
70 4
    private function getContentType(): ?string
71
    {
72 4
        return $this->contentType;
73
    }
74
75 4
    private function getHeaders(): ?Objects\HeadersFactory
76
    {
77 4
        return $this->headers;
78
    }
79
80 4
    private function getStyle(): ?string
81
    {
82 4
        return $this->style;
83
    }
84
85 4
    private function isAllowReserved(): bool
86
    {
87 4
        return $this->allowReserved;
88
    }
89
90 4
    private function isExplode(): bool
91
    {
92 4
        return $this->explode;
93
    }
94
}
95