User::fromData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 12
nc 1
nop 5
1
<?php
2
3
namespace Shrikeh\PagerDuty\Entity\User;
4
5
use Shrikeh\PagerDuty\Entity\User as UserInterface;
6
7
use Psr\Http\Message\UriInterface;
8
use Shrikeh\PagerDuty\Collection;
9
10
final class User implements UserInterface
11
{
12
    private $contactMethods;
13
14
    private $self;
15
16
    private $name;
17
18
    private $email;
19
20
    private $summary;
21
22
    public static function fromData(
23
        Collection $contactMethods,
24
        UriInterface $self,
25
        $name,
26
        $email,
27
        $summary
28
    ) {
29
        return new static(
30
            $contactMethods,
31
            $name,
32
            $email,
33
            $summary,
34
            $self
35
        );
36
    }
37
38
    public function contactMethods()
39
    {
40
        return $this->contactMethods;
41
    }
42
43
    private function __construct(
44
        Collection $contactMethods,
45
        $name,
46
        $email,
47
        $summary,
48
        UriInterface $self = null
49
    )
50
    {
0 ignored issues
show
Coding Style introduced by
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
Loading history...
51
        $this->contactMethods = $contactMethods;
52
        $this->name           = $name;
53
        $this->email          = $email;
54
        $this->summary        = $summary;
55
        $this->self           = $self;
56
    }
57
}
58