Nationality   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 60
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 4 1
A getPinyin() 0 4 1
A getPopulation() 0 4 1
A jsonSerialize() 0 8 1
1
<?php
2
/*
3
 * This file is part of the Slince/China package.
4
 *
5
 * (c) Slince <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace China\Nationality;
12
13
class Nationality implements NationalityInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $name;
19
20
    /**
21
     * @var string
22
     */
23
    protected $pinyin;
24
25
    /**
26
     * @var number
27
     */
28
    protected $population;
29
30
    public function __construct($name, $pinyin, $population)
31
    {
32
        $this->name = $name;
33
        $this->pinyin = $pinyin;
34
        $this->population = $population;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getName()
41
    {
42
        return $this->name;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getPinyin()
49
    {
50
        return $this->pinyin;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getPopulation()
57
    {
58
        return $this->population;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function jsonSerialize()
65
    {
66
        return [
67
            'name' => $this->name,
68
            'pinyin' => $this->pinyin,
69
            'population' => $this->population,
70
        ];
71
    }
72
}