Completed
Push — uv-index ( 9af66d )
by Christian
02:24
created

City   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 44
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 4
1
<?php
2
/**
3
 * OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
4
 *
5
 * @license MIT
6
 *
7
 * Please see the LICENSE file distributed with this source code for further
8
 * information regarding copyright and licensing.
9
 *
10
 * Please visit the following links to read about the usage policies and the license of
11
 * OpenWeatherMap before using this class:
12
 *
13
 * @see http://www.OpenWeatherMap.org
14
 * @see http://www.OpenWeatherMap.org/terms
15
 * @see http://openweathermap.org/appid
16
 */
17
18
namespace Cmfcmf\OpenWeatherMap\Util;
19
20
/**
21
 * The city class representing a city object.
22
 */
23
class City extends Location
24
{
25
    /**
26
     * @var int The city id.
27
     */
28
    public $id;
29
30
    /**
31
     * @var string The name of the city.
32
     */
33
    public $name;
34
35
    /**
36
     * @var string The abbreviation of the country the city is located in.
37
     */
38
    public $country;
39
40
    /**
41
     * @var int The city's population
42
     */
43
    public $population;
44
45
    /**
46
     * Create a new city object.
47
     *
48
     * @param int    $id         The city id.
49
     * @param string $name       The name of the city.
50
     * @param float  $lon        The longitude of the city.
51
     * @param float  $lat        The latitude of the city.
52
     * @param string $country    The abbreviation of the country the city is located in
53
     * @param int    $population The city's population.
54
     *
55
     * @internal
56
     */
57 19
    public function __construct($id, $name = null, $lon = null, $lat = null, $country = null, $population = null)
58
    {
59 19
        $this->id = (int)$id;
60 19
        $this->name = isset($name) ? (string)$name : null;
61 19
        $this->country = isset($country) ? (string)$country : null;
62 19
        $this->population = isset($population) ? (int)$population : null;
63
64 19
        parent::__construct($lon, $lat);
65 19
    }
66
}
67