Completed
Pull Request — master (#4)
by Leo
07:33
created

State::getCapital()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Brazanation\States;
4
5
class State implements StateInterface
6
{
7
    protected $data;
8
9 38
    public function __construct(array $data)
10
    {
11 38
        $this->data = $data;
12 38
    }
13
14 1
    public function getData()
15
    {
16 1
        return $this->data;
17
    }
18
19 36
    public function getItem($key, $default = null)
20
    {
21 36
        return array_key_exists($key, $this->data) ? $this->data[$key] : $default;
22
    }
23
24 28
    public function getName()
25
    {
26 28
        return $this->getItem('name');
27
    }
28
29 28
    public function getAbbr()
30
    {
31 28
        return $this->getItem('abbr');
32
    }
33
34 28
    public function getCapital()
35
    {
36 28
        return $this->getItem('capital');
37
    }
38
39 28
    public function getRegion()
40
    {
41 28
        return $this->getItem('region');
42
    }
43
44 28
    public function getTimezone()
45
    {
46 28
        return $this->getItem('timezone');
47
    }
48
49 28
    public function getDst()
50
    {
51 28
        return $this->getItem('dst');
52
    }
53
54 28
    public function getSlug()
55
    {
56 28
        return $this->getItem('slug');
57
    }
58
}
59