Push   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 4 1
A address() 0 4 1
A deviceType() 0 4 1
A sounds() 0 4 1
B __construct() 0 24 1
1
<?php
2
3
namespace Shrikeh\PagerDuty\Entity\ContactMethod\Resource;
4
5
use InvalidArgumentException;
6
use OutOfBoundsException;
7
8
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource;
9
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Blacklisted;
10
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Blacklistable;
11
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Type;
12
13
final class Push implements Resource, Blacklistable
14
{
15
    const MAX_ADDRESS_LENGTH = 64;
16
17
    use Type;
18
    use Blacklisted;
19
20
    private $address;
21
22
    private $deviceType;
23
24
    private $sounds;
25
26
    public function __construct(
27
        $address,
28
        $type,
29
        $sounds = array(),
30
        $blacklisted = false
0 ignored issues
show
Unused Code introduced by
The parameter $blacklisted 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...
31
    ) {
32
        // if (!ctype_xdigit($address)) {
33
        //     $msg = 'Address must be hexadecimal, but received %s';
34
        //     throw new \InvalidArgumentException(
35
        //         sprintf($msg, $address)
36
        //     );
37
        // }
38
        // $length = strlen($address);
39
        // if ($length > static::MAX_ADDRESS_LENGTH) {
40
        //     $msg = 'Expected address to be a maximum of %d characters, but was given %d';
41
        //     throw new OutOfBoundsException(
42
        //         sprintf($msg, static::MAX_ADDRESS_LENGTH, $length)
43
        //     );
44
        // }
45
46
        $this->address = $address;
47
        $this->deviceType = $type;
48
        $this->sounds = $sounds;
49
    }
50
51
    public function __toString()
52
    {
53
        return $this->address();
54
    }
55
56
    public function address()
57
    {
58
        return $this->address;
59
    }
60
61
    public function deviceType()
62
    {
63
        return $this->deviceType;
64
    }
65
66
    public function sounds()
67
    {
68
        return $this->sounds;
69
    }
70
}
71