Completed
Push — master ( b1e3a4...5e9926 )
by Dariusz
01:36
created

Forecast::country()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
1
<?php
2
namespace Dwr\OpenWeather\Response;
3
4
class Forecast implements ResponseInterface
5
{
6
    /**
7
     * @var array
8
     */
9
    private $city;
10
11
    /**
12
     * @var string
13
     */
14
    private $message;
15
16
    /**
17
     * @var int
18
     */
19
    private $cnt;
20
21
    /**
22
     * @var array
23
     */
24
    private $list;
25
26
    /**
27
     * Weather constructor.
28
     * @param array $data
29
     */
30
    public function __construct(array $data)
31
    {
32
        foreach ($data as $key => $value) {
33
            if (property_exists($this, $key)) {
34
                $this->$key = $value;
35
            }
36
        }
37
    }
38
39
    /**
40
     * @return array
41
     */
42
    public function city()
43
    {
44
        return $this->city;
45
    }
46
47
    public function cityName()
48
    {
49
        return ($this->city) ? $this->city['name'] : '';
50
    }
51
52
    public function country()
53
    {
54
        return ($this->city) ? $this->city['country'] : '';
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function message()
61
    {
62
        return $this->message;
63
    }
64
65
    /**
66
     * @return int
67
     */
68
    public function cnt()
69
    {
70
        return $this->cnt;
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    public function lists()
77
    {
78
        return $this->list;
79
    }
80
}
81