Season::getYear()   A
last analyzed

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 NekoAPI\Component\Entity;
4
5
/**
6
 * Class Season
7
 *
8
 * @package NekoAPI\Component\Entity
9
 * @author  Aurimas Niekis <[email protected]>
10
 */
11
class Season extends BaseNameEntity
12
{
13
    /**
14
     * @var int
15
     */
16
    private $year;
17
18 2
    public function __construct(string $name, int $year)
19
    {
20 2
        parent::__construct($name);
21
22 2
        $this->year = $year;
23 2
    }
24
25
    /**
26
     * @return int
27
     */
28 2
    public function getYear(): ?int
29
    {
30 2
        return $this->year;
31
    }
32
33
    /**
34
     * @param int $year
35
     *
36
     * @return Season
37
     */
38 1
    public function setYear(int $year): Season
39
    {
40 1
        $this->year = $year;
41
42 1
        return $this;
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48 1
    public function jsonSerialize(): array
49
    {
50
        return [
51 1
            'name' => $this->getName(),
52 1
            'year' => $this->getYear(),
53
        ];
54
    }
55
}