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

TVEpisode::getProductionCode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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