Birthday   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 84
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setYear() 0 4 1
A setMonth() 0 4 1
A setDay() 0 4 1
A getYear() 0 4 1
A getMonth() 0 4 1
A getDay() 0 4 1
A createFromArray() 0 4 1
1
<?php
2
/*
3
 * This file is part of the slince/smartqq 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 Slince\SmartQQ\Entity;
12
13
class Birthday
14
{
15
    /**
16
     * @var int
17
     */
18
    protected $year;
19
20
    /**
21
     * @var int
22
     */
23
    protected $month;
24
25
    /**
26
     * @var int
27
     */
28
    protected $day;
29
30
    public function __construct($year, $month, $day)
31
    {
32
        $this->year = $year;
33
        $this->month = $month;
34
        $this->day = $day;
35
    }
36
37
    /**
38
     * @param int $year
39
     */
40
    public function setYear($year)
41
    {
42
        $this->year = $year;
43
    }
44
45
    /**
46
     * @param int $month
47
     */
48
    public function setMonth($month)
49
    {
50
        $this->month = $month;
51
    }
52
53
    /**
54
     * @param int $day
55
     */
56
    public function setDay($day)
57
    {
58
        $this->day = $day;
59
    }
60
61
    /**
62
     * @return int
63
     */
64
    public function getYear()
65
    {
66
        return $this->year;
67
    }
68
69
    /**
70
     * @return int
71
     */
72
    public function getMonth()
73
    {
74
        return $this->month;
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getDay()
81
    {
82
        return $this->day;
83
    }
84
85
    /**
86
     * 创建生日.
87
     *
88
     * @param array $data
89
     *
90
     * @return Birthday
91
     */
92
    public static function createFromArray(array $data)
93
    {
94
        return new static($data['year'], $data['month'], $data['day']);
95
    }
96
}
97