Passed
Push — master ( 9f17d2...e5ff49 )
by
unknown
03:30
created

TVSeason   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 2
cbo 1
dl 0
loc 46
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getId() 0 4 1
A getAirDate() 0 4 1
A getEpisodeCount() 0 4 1
A getSeasonNumber() 0 4 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