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

Address::getReverse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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