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

LicenseBuilder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 41
ccs 15
cts 15
cp 1
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 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