Completed
Push — master ( a8cb62...764ba2 )
by François
03:52
created

Address   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

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

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
A getId() 0 4 1
A setId() 0 4 1
A getValue() 0 4 1
A setValue() 0 5 1
A getHostname() 0 4 1
A setHostname() 0 4 1
A getReverse() 0 4 1
A getAsNumber() 0 4 1
A getNetworkName() 0 4 1
A getCountryCode() 0 4 1
A getFlags() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Bouncer package.
5
 *
6
 * (c) François Hodierne <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Bouncer;
13
14
class Address extends Resource
15
{
16
17
    protected $id;
18
19
    protected $value;
20
21
    protected $hostname;
22
23
    public function __construct($attributes = null)
24
    {
25
        if (is_string($attributes)) {
26
            $this->setValue($attributes);
27
        } elseif (is_array($attributes)) {
28
            parent::__construct($attributes);
29
        }
30
    }
31
32
    public function getId()
33
    {
34
        return $this->id;
35
    }
36
37
    public function setId($id)
38
    {
39
        $this->id = $id;
40
    }
41
42
    public function getValue()
43
    {
44
        return $this->value;
45
    }
46
47
    public function setValue($value)
48
    {
49
        $this->value = $value;
50
        $this->id = Bouncer::hash($this->value);
51
    }
52
53
    public function getHostname()
54
    {
55
        return $this->hostname;
56
    }
57
58
    public function setHostname($hostname)
59
    {
60
        $this->hostname = $hostname;
61
    }
62
63
    public function getReverse()
64
    {
65
        return $this->getAttribute('reverse');
66
    }
67
68
    public function getAsNumber()
69
    {
70
        return $this->getAttribute('as_number');
71
    }
72
73
    public function getNetworkName()
74
    {
75
        return $this->getAttribute('network_name');
76
    }
77
78
    public function getCountryCode()
79
    {
80
        return $this->getAttribute('country_code');
81
    }
82
83
    public function getFlags()
84
    {
85
        return $this->getAttribute('flags');
86
    }
87
88
}
89