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

ContactBuilder   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A createContact() 0 9 1
A setEmail() 0 6 1
A setName() 0 6 1
A setUrl() 0 6 1
A getEmail() 0 4 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\Contact;
8
use Aweapi\Openapi\Objects\ContactFactory;
9
10
final class ContactBuilder implements ContactFactory
11
{
12
    use Properties\OptionalExtensions;
13
14
    private $email;
15
16
    private $name;
17
18
    private $url;
19
20
    public function createContact(): Contact
21
    {
22
        return new Contact(
23
            $this->getName(),
24
            $this->getUrl(),
25
            $this->getEmail(),
26
            $this->getExtensions()
27
        );
28
    }
29
30
    public function setEmail(string $email): self
31
    {
32
        $this->email = $email;
33
34
        return $this;
35
    }
36
37
    public function setName(string $name): self
38
    {
39
        $this->name = $name;
40
41
        return $this;
42
    }
43
44
    public function setUrl(string $url): self
45
    {
46
        $this->url = $url;
47
48
        return $this;
49
    }
50
51
    private function getEmail(): ?string
52
    {
53
        return $this->email;
54
    }
55
56
    private function getName(): ?string
57
    {
58
        return $this->name;
59
    }
60
61
    private function getUrl(): ?string
62
    {
63
        return $this->url;
64
    }
65
}
66