Passed
Push — master ( 74d4a8...9f17d2 )
by
unknown
01:31
created

TVSeason::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
crap 1
1
<?php
2
3
namespace vfalies\tmdb\Results;
4
5
use vfalies\tmdb\Abstracts\Results;
6
use vfalies\tmdb\Tmdb;
7
use vfalies\tmdb\Interfaces\Results\TVSeasonResultsInterface;
8
9
class TVSeason extends Results implements TVSeasonResultsInterface
10
{
11
12
    protected $episode_count = 0;
13
    protected $season_number = 0;
14
    protected $poster_path   = null;
15
    protected $air_date  = null;
16
17
    /**
18
     * Constructor
19
     * @param \vfalies\tmdb\Tmdb $tmdb
20
     * @param \stdClass $result
21
     * @throws \Exception
22
     */
23 5
    public function __construct(Tmdb $tmdb, \stdClass $result)
24
    {
25 5
        parent::__construct($tmdb, $result);
26
27
        // Populate data
28 5
        $this->id            = $this->data->id;
29 5
        $this->air_date  = $this->data->air_date;
30 5
        $this->episode_count = $this->data->episode_count;
31 5
        $this->poster_path   = $this->data->poster_path;
32 5
        $this->season_number = $this->data->season_number;
33 5
    }
34
35 1
    public function getId(): int
36
    {
37 1
        return $this->id;
38
    }
39
40 1
    public function getAirDate(): string
41
    {
42 1
        return $this->air_date;
43
    }
44
45 1
    public function getEpisodeCount(): int
46
    {
47 1
        return (int) $this->episode_count;
48
    }
49
50 1
    public function getSeasonNumber(): int
51
    {
52 1
        return (int) $this->season_number;
53
    }
54
}
55