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

LicenseBuilder::createLicense()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 LicenseBuilder implements Objects\LicenseFactory
10
{
11
    use Properties\OptionalExtensions;
12
13
    private $name;
14
15
    private $url;
16
17 3
    public function createLicense(): Objects\License
18
    {
19 3
        return new Objects\License(
20 3
            $this->getName(),
21 3
            $this->getUrl(),
22 3
            $this->getExtensions()
23
        );
24
    }
25
26 3
    public function setName(string $name): self
27
    {
28 3
        $this->name = $name;
29
30 3
        return $this;
31
    }
32
33 1
    public function setUrl(string $url): self
34
    {
35 1
        $this->url = $url;
36
37 1
        return $this;
38
    }
39
40 3
    private function getName(): string
41
    {
42 3
        return $this->name;
43
    }
44
45 3
    private function getUrl(): ?string
46
    {
47 3
        return $this->url;
48
    }
49
}
50