Passed
Push — master ( 67aa47...d37a32 )
by vincent
02:27
created

TVShow::getStatus()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
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\Interfaces\TVShowInterface;
6
use vfalies\tmdb\Tmdb;
7
8
class TVShow extends Item implements TVShowInterface
9
{
10
11 28
    public function __construct(Tmdb $tmdb, int $tv_id, array $options = array())
12
    {
13 28
        parent::__construct($tmdb, $tv_id, $options, 'tv');
14 27
    }
15
16
    /**
17
     * Get TV show id
18
     * @return int
19
     */
20 1
    public function getId(): int
21
    {
22 1
        return $this->id;
23
    }
24
25
    /**
26
     * Get TVSHow genres
27
     * @return array
28
     */
29 2
    public function getGenres(): array
30
    {
31 2
        if (isset($this->data->genres))
32
        {
33 1
            return $this->data->genres;
34
        }
35 1
        return [];
36
    }
37
38
    /**
39
     * Get TVshow note
40
     *  @return float
41
     */
42 2
    public function getNote(): float
43
    {
44 2
        if (isset($this->data->vote_average))
45
        {
46 1
            return $this->data->vote_average;
47
        }
48 1
        return 0;
49
    }
50
51
    /**
52
     * Get TVshow number of episodes
53
     * @return int
54
     */
55 2
    public function getNumberEpisodes(): int
56
    {
57 2
        if (isset($this->data->number_of_episodes))
58
        {
59 1
            return $this->data->number_of_episodes;
60
        }
61 1
        return 0;
62
    }
63
64
    /**
65
     * Get TVShow number of seasons
66
     * @return int
67
     */
68 2
    public function getNumberSeasons(): int
69
    {
70 2
        if (isset($this->data->number_of_seasons))
71
        {
72 1
            return $this->data->number_of_seasons;
73
        }
74 1
        return 0;
75
    }
76
77
    /**
78
     * Get TVShow original title
79
     * @return string
80
     */
81 2
    public function getOriginalTitle(): string
82
    {
83 2
        if (isset($this->data->original_name))
84
        {
85 1
            return $this->data->original_name;
86
        }
87 1
        return '';
88
    }
89
90
    /**
91
     * Get TVShow overview
92
     * @return string
93
     */
94 2
    public function getOverview(): string
95
    {
96 2
        if (isset($this->data->overview))
97
        {
98 1
            return $this->data->overview;
99
        }
100 1
        return '';
101
    }
102
103
    /**
104
     * Get TVShow release date
105
     * @return string
106
     */
107 2
    public function getReleaseDate(): string
108
    {
109 2
        if (isset($this->data->first_air_date))
110
        {
111 1
            return $this->data->first_air_date;
112
        }
113 1
        return '';
114
    }
115
116
    /**
117
     * Get TVShow status
118
     * @return string
119
     */
120 2
    public function getStatus(): string
121
    {
122 2
        if (isset($this->data->status))
123
        {
124 1
            return $this->data->status;
125
        }
126 1
        return '';
127
    }
128
129
    /**
130
     * Get TVShow title
131
     * @return string
132
     */
133 2
    public function getTitle(): string
134
    {
135 2
        if (isset($this->data->name))
136
        {
137 1
            return $this->data->name;
138
        }
139 1
        return '';
140
    }
141
142
    /**
143
     * Get TVShow seasons
144
     * @return \Generator
145
     * @throws \Exception
146
     */
147
    public function getSeasons() : \Generator
148
    {
149
        throw new \Exception('Not yet implemented');
150
    }
151
}
152