Test Failed
Pull Request — master (#17)
by
unknown
03:56
created

TVSeason::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
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 $release_date  = null;
16
17
    /**
18
     * Constructor
19
     * @param \vfalies\tmdb\Tmdb $tmdb
20
     * @param \stdClass $result
21
     * @throws \Exception
22
     */
23
    public function __construct(Tmdb $tmdb, \stdClass $result)
24
    {
25
        parent::__construct($tmdb, $result);
26
27
        // Populate data
28
        $this->id            = $this->data->id;
29
        $this->release_date  = $this->data->air_date;
30
        $this->episode_count = $this->data->episode_count;
31
        $this->poster_path   = $this->data->poster_path;
32
        $this->season_number = $this->data->season_number;
33
    }
34
35
    public function getId(): int
36
    {
37
        return $this->id;
38
    }
39
40
    public function getReleaseDate(): string
41
    {
42
        return $this->release_date;
43
    }
44
45
    public function getEpisodeCount(): int
46
    {
47
        return (int) $this->episode_count;
48
    }
49
50
    public function getSeasonNumber(): int
51
    {
52
        return (int) $this->season_number;
53
    }
54
}
55