Passed
Push — master ( c8eef5...05c3b4 )
by Davide
56s queued 10s
created

Host::getPhone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace DavidePastore\Ipinfo;
4
5
/**
6
 * Represent an host with all the details.
7
 *
8
 * @author davidepastore
9
 */
10
class Host
11
{
12
    /**
13
     * Contains all the properties of the host.
14
     *
15
     * @var array
16
     */
17
    protected $properties;
18
19
    /**
20
     * Create an Host object with all the properties.
21
     *
22
     * @param array $properties
23
     */
24 5
    public function __construct($properties = array())
25
    {
26
        //Merge default values
27 5
        $this->properties = array_merge(array(
28 5
                Ipinfo::CITY => '',
29 5
                Ipinfo::COUNTRY => '',
30 5
                Ipinfo::HOSTNAME => '',
31 5
                Ipinfo::IP => '',
32 5
                Ipinfo::LOC => '',
33 5
                Ipinfo::ORG => '',
34 5
                Ipinfo::PHONE => '',
35 5
                Ipinfo::POSTAL => '',
36 5
                Ipinfo::REGION => '',
37 5
        ), $properties);
38 5
    }
39
40
    /**
41
     * Get the city value.
42
     */
43 1
    public function getCity()
44
    {
45 1
        return $this->properties[Ipinfo::CITY];
46
    }
47
48
    /**
49
     * Get the country value.
50
     */
51 1
    public function getCountry()
52
    {
53 1
        return $this->properties[Ipinfo::COUNTRY];
54
    }
55
56
    /**
57
     * Get the hostname value.
58
     */
59 1
    public function getHostname()
60
    {
61 1
        return $this->properties[Ipinfo::HOSTNAME];
62
    }
63
64
    /**
65
     * Get the ip value.
66
     */
67 1
    public function getIp()
68
    {
69 1
        return $this->properties[Ipinfo::IP];
70
    }
71
72
    /**
73
     * Get the loc value.
74
     */
75 1
    public function getLoc()
76
    {
77 1
        return $this->properties[Ipinfo::LOC];
78
    }
79
80
    /**
81
     * Get the org value.
82
     */
83 1
    public function getOrg()
84
    {
85 1
        return $this->properties[Ipinfo::ORG];
86
    }
87
88
    /**
89
     * Get the phone value.
90
     */
91 1
    public function getPhone()
92
    {
93 1
        return $this->properties[Ipinfo::PHONE];
94
    }
95
96
    /**
97
     * Get the postal value.
98
     */
99 1
    public function getPostal()
100
    {
101 1
        return $this->properties[Ipinfo::POSTAL];
102
    }
103
104
    /**
105
     * Get the region value.
106
     */
107 1
    public function getRegion()
108
    {
109 1
        return $this->properties[Ipinfo::REGION];
110
    }
111
112
    /**
113
     * Get all the properties.
114
     *
115
     * @return array An associative array with all the properties.
116
     */
117 2
    public function getProperties()
118
    {
119 2
        return $this->properties;
120
    }
121
}
122