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

TVEpisode::getId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
3
namespace vfalies\tmdb\Items;
4
5
use vfalies\tmdb\Abstracts\Item;
6
use vfalies\tmdb\Interfaces\Items\TVEpisodeInterface;
7
use vfalies\tmdb\Tmdb;
8
use vfalies\tmdb\Exceptions\NotYetImplementedException;
9
10
class TVEpisode extends Item implements TVEpisodeInterface
11
{
12
13 20
    public function __construct(Tmdb $tmdb, int $tv_id, int $season_number, int $episode_number, array $options = array())
14
    {
15 20
        parent::__construct($tmdb, $episode_number, $options, 'tv/' . $tv_id . '/' . $season_number);
16 20
    }
17
18
    /**
19
     * Get TV show id
20
     * @return int
21
     */
22 2
    public function getId(): int
23
    {
24 2
        if (isset($this->data->id)) {
25 1
            return (int) $this->data->id;
26
        }
27 1
        return 0;
28
    }
29
30 2
    public function getAirDate(): string
31
    {
32 2
        if (isset($this->data->air_date)) {
33 1
            return $this->data->air_date;
34
        }
35 1
        return '';
36
    }
37
38
    /**
39
     * @codeCoverageIgnore
40
     * @throws NotYetImplementedException
41
     */
42
    public function getCrew(): \Generator
43
    {
44
        throw new NotYetImplementedException;
45
    }
46
47 2
    public function getEpisodeNumber(): int
48
    {
49 2
        if (isset($this->data->episode_number)) {
50 1
            return $this->data->episode_number;
51
        }
52 1
        return 0;
53
    }
54
55
    /**
56
     * @codeCoverageIgnore
57
     * @throws NotYetImplementedException
58
     */
59
    public function getGuestStars(): \Generator
60
    {
61
        throw new NotYetImplementedException;
62
    }
63
64 2
    public function getName(): string
65
    {
66 2
        if (isset($this->data->name)) {
67 1
            return $this->data->name;
68
        }
69 1
        return '';
70
    }
71
72 2
    public function getNote(): float
73
    {
74 2
        if (isset($this->data->vote_average)) {
75 1
            return $this->data->vote_average;
76
        }
77 1
        return 0;
78
    }
79
80 2
    public function getNoteCount(): int
81
    {
82 2
        if (isset($this->data->vote_count)) {
83 1
            return (int) $this->data->vote_count;
84
        }
85 1
        return 0;
86
    }
87
88 2
    public function getOverview(): string
89
    {
90 2
        if (isset($this->data->overview)) {
91 1
            return $this->data->overview;
92
        }
93 1
        return '';
94
    }
95
96 2
    public function getProductionCode(): string
97
    {
98 2
        if (isset($this->data->production_code)) {
99 1
            return $this->data->production_code;
100
        }
101 1
        return '';
102
    }
103
104 2
    public function getSeasonNumber(): int
105
    {
106 2
        if (isset($this->data->season_number)) {
107 1
            return (int) $this->data->season_number;
108
        }
109 1
        return 0;
110
    }
111
112 2
    public function getStillPath(): string
113
    {
114 2
        if (isset($this->data->still_path)) {
115 1
            return $this->data->still_path;
116
        }
117 1
        return '';
118
    }
119
}
120