Subscription   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 0
dl 0
loc 81
ccs 21
cts 21
cp 1
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A loadFromResponse() 0 7 1
A isActive() 0 4 1
A getId() 0 4 1
A getKey() 0 4 1
A getUuid() 0 4 1
A getDashboardUrl() 0 4 1
A getExpirationDate() 0 4 1
A getProductName() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Acquia\Network;
4
5
class Subscription extends \ArrayObject
6
{
7
    /**
8
     * @param string $networkId
9
     * @param string $networkKey
10
     * @param array $response
11
     *
12
     * @return \Acquia\Network\Subscription
13
     */
14 9
    public static function loadFromResponse($networkId, $networkKey, array $response)
15
    {
16 9
        $subscription = new static($response['body']);
17 9
        $subscription['id'] = $networkId;
18 9
        $subscription['key'] = $networkKey;
19 9
        return $subscription;
20
    }
21
22
    /**
23
     * @return bool
24
     */
25 9
    public function isActive()
26
    {
27 9
        return !empty($this['active']);
28
    }
29
30
    /**
31
     * @return string
32
     */
33 3
    public function getId()
34
    {
35 3
        return $this['id'];
36
    }
37
38
    /**
39
     * @return string
40
     */
41 6
    public function getKey()
42
    {
43 6
        return $this['key'];
44
    }
45
46
    /**
47
     * @return string
48
     */
49 3
    public function getUuid()
50
    {
51 3
        return $this['uuid'];
52
    }
53
54
    /**
55
     * @return string
56
     */
57 3
    public function getDashboardUrl()
58
    {
59 3
        return $this['href'];
60
    }
61
62
    /**
63
     * @return \DateTime
64
     */
65 3
    public function getExpirationDate()
66
    {
67 3
        return new \DateTime($this['expiration_date']['value']);
68
    }
69
70
    /**
71
     * @return string
72
     */
73 3
    public function getProductName()
74
    {
75 3
        return $this['product']['view'];
76
    }
77
78
    /**
79
     * @return string
80
     */
81 3
    public function __toString()
82
    {
83 3
        return $this->getUuid();
84
    }
85
}
86