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

TVEpisode   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 13
lcom 4
cbo 2
dl 0
loc 105
ccs 33
cts 33
cp 1
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 1
A getAirDate() 0 4 1
A getCrew() 0 4 1
A getEpisodeNumber() 0 4 1
A getGuestStars() 0 4 1
A getId() 0 4 1
A getName() 0 4 1
A getNote() 0 4 1
A getNoteCount() 0 4 1
A getOverview() 0 4 1
A getProductionCode() 0 4 1
A getSeasonNumber() 0 4 1
A getStillPath() 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\TVEpisodeResultsInterface;
8
use vfalies\tmdb\Exceptions\NotYetImplementedException;
9
10
class TVEpisode extends Results implements TVEpisodeResultsInterface
11
{
12
13
    protected $episode_number  = 0;
14
    protected $name            = '';
15
    protected $air_date        = null;
16
    protected $season_number   = 0;
17
    protected $vote_average    = 0;
18
    protected $vote_count      = 0;
19
    protected $overview        = '';
20
    protected $production_code = '';
21
    protected $still_path      = '';
22
23
    /**
24
     * Constructor
25
     * @param \vfalies\tmdb\Tmdb $tmdb
26
     * @param \stdClass $result
27
     * @throws \Exception
28
     */
29 11
    public function __construct(Tmdb $tmdb, \stdClass $result)
30
    {
31 11
        parent::__construct($tmdb, $result);
32
33
        // Populate data
34 11
        $this->id              = $this->data->id;
35 11
        $this->air_date        = $this->data->air_date;
36 11
        $this->season_number   = $this->data->season_number;
37 11
        $this->episode_number  = $this->data->episode_number;
38 11
        $this->name            = $this->data->name;
39 11
        $this->vote_average    = $this->data->vote_average;
40 11
        $this->vote_count      = $this->data->vote_count;
41 11
        $this->overview        = $this->data->overview;
42 11
        $this->production_code = $this->data->production_code;
43 11
        $this->still_path      = $this->data->still_path;
44 11
    }
45
46 1
    public function getAirDate(): string
47
    {
48 1
        return $this->air_date;
49
    }
50
51
    /**
52
     * @codeCoverageIgnore
53
     * @throws NotYetImplementedException
54
     */
55
    public function getCrew(): \Generator
56
    {
57
        throw new NotYetImplementedException;
58
    }
59
60 1
    public function getEpisodeNumber(): int
61
    {
62 1
        return (int) $this->episode_number;
63
    }
64
65
    /**
66
     * @codeCoverageIgnore
67
     * @throws NotYetImplementedException
68
     */
69
    public function getGuestStars(): \Generator
70
    {
71
        throw new NotYetImplementedException;
72
    }
73
74 1
    public function getId(): int
75
    {
76 1
        return (int) $this->id;
77
    }
78
79 1
    public function getName(): string
80
    {
81 1
        return $this->name;
82
    }
83
84 1
    public function getNote(): float
85
    {
86 1
        return $this->vote_average;
87
    }
88
89 1
    public function getNoteCount(): int
90
    {
91 1
        return (int) $this->vote_count;
92
    }
93
94 1
    public function getOverview(): string
95
    {
96 1
        return $this->overview;
97
    }
98
99 1
    public function getProductionCode(): string
100
    {
101 1
        return $this->production_code;
102
    }
103
104 1
    public function getSeasonNumber(): int
105
    {
106 1
        return (int) $this->season_number;
107
    }
108
109 1
    public function getStillPath(): string
110
    {
111 1
        return $this->still_path;
112
    }
113
114
}
115