ContactMethod::method()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Shrikeh\PagerDuty\Entity\ContactMethod;
4
5
use Psr\Http\Message\UriInterface;
6
use Shrikeh\PagerDuty\Entity\ContactMethod as ContactMethodInterface;
7
8
final class ContactMethod implements ContactMethodInterface
9
{
10
    private $resource;
11
12
    private $self;
13
14
    private $summary;
15
16
    private $label;
17
18
    public static function fromApi(
19
        Resource $resource,
20
        UriInterface $self,
21
        $summary,
22
        $label
23
    ) {
24
        return new static(
25
            $resource,
26
            $summary,
27
            $label,
28
            $self
29
        );
30
    }
31
32
    private function __construct(
33
        Resource $resource,
34
        $summary,
35
        $label,
0 ignored issues
show
Unused Code introduced by
The parameter $label is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
36
        UriInterface $self = null
37
    ) {
38
        $this->resource = $resource;
39
        $this->self = $self;
40
        $this->summary = $summary;
41
    }
42
43
    public function __toString()
44
    {
45
        return (string) $this->resource();
46
    }
47
48
    public function method()
49
    {
50
        return $this->resource()->type();
51
    }
52
53
    public function resource()
54
    {
55
        return $this->resource;
56
    }
57
58
    public function summary()
59
    {
60
        return $this->summary;
61
    }
62
63
    public function self()
64
    {
65
        return $this->self;
66
    }
67
68
    public function label()
69
    {
70
        return $this->label;
71
    }
72
73
    public function blacklisted()
74
    {
75
        return $this->blacklisted;
0 ignored issues
show
Bug introduced by
The property blacklisted does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
76
    }
77
}
78