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

LicenseBuilder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 41
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createLicense() 0 8 1
A setName() 0 6 1
A setUrl() 0 6 1
A getName() 0 4 1
A getUrl() 0 4 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
    public function createLicense(): Objects\License
18
    {
19
        return new Objects\License(
20
            $this->getName(),
21
            $this->getUrl(),
22
            $this->getExtensions()
23
        );
24
    }
25
26
    public function setName(string $name): self
27
    {
28
        $this->name = $name;
29
30
        return $this;
31
    }
32
33
    public function setUrl(string $url): self
34
    {
35
        $this->url = $url;
36
37
        return $this;
38
    }
39
40
    private function getName(): string
41
    {
42
        return $this->name;
43
    }
44
45
    private function getUrl(): ?string
46
    {
47
        return $this->url;
48
    }
49
}
50