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

Movie::getTagLine()   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\MovieInterface;
6
use vfalies\tmdb\Tmdb;
7
8
class Movie extends Item implements MovieInterface
9
{
10
    /**
11
     * Constructor
12
     * @param \vfalies\tmdb\Tmdb $tmdb
13
     * @param int $movie_id
14
     * @param array $options
15
     * @throws Exception
16
     */
17 28
    public function __construct(Tmdb $tmdb, int $movie_id, array $options = array())
18
    {
19 28
        parent::__construct($tmdb, $movie_id, $options, 'movie');
20 27
    }
21
22
    /**
23
     * Get movie genres
24
     * @return array
25
     */
26 2
    public function getGenres(): array
27
    {
28 2
        if (isset($this->data->genres))
29
        {
30 1
            return $this->data->genres;
31
        }
32 1
        return [];
33
    }
34
35
    /**
36
     * Get movie title
37
     * @return string
38
     */
39 2
    public function getTitle(): string
40
    {
41 2
        if (isset($this->data->title))
42
        {
43 1
            return $this->data->title;
44
        }
45 1
        return '';
46
    }
47
48
    /**
49
     * Get movie overview
50
     * @return string
51
     */
52 2
    public function getOverview(): string
53
    {
54 2
        if (isset($this->data->overview))
55
        {
56 1
            return $this->data->overview;
57
        }
58 1
        return '';
59
    }
60
61
    /**
62
     * Get movie release date
63
     * @return string
64
     */
65 2
    public function getReleaseDate(): string
66
    {
67 2
        if (isset($this->data->release_date))
68
        {
69 1
            return $this->data->release_date;
70
        }
71 1
        return '';
72
    }
73
74
    /**
75
     * Get movie original title
76
     * @return string
77
     */
78 2
    public function getOriginalTitle(): string
79
    {
80 2
        if (isset($this->data->original_title))
81
        {
82 1
            return $this->data->original_title;
83
        }
84 1
        return '';
85
    }
86
87
    /**
88
     * Get movie note
89
     * @return float
90
     */
91 2
    public function getNote(): float
92
    {
93 2
        if (isset($this->data->vote_average))
94
        {
95 1
            return $this->data->vote_average;
96
        }
97 1
        return 0;
98
    }
99
100
    /**
101
     * Get movie id
102
     * @return int
103
     */
104 1
    public function getId(): int
105
    {
106 1
        return $this->id;
107
    }
108
109
    /**
110
     * Get IMDB movie id
111
     * @return string
112
     */
113 2
    public function getIMDBId(): string
114
    {
115 2
        if (isset($this->data->imdb_id))
116
        {
117 1
            return $this->data->imdb_id;
118
        }
119 1
        return '';
120
    }
121
122
    /**
123
     * Get movie tagline
124
     * @return string
125
     */
126 2
    public function getTagLine(): string
127
    {
128 2
        if (isset($this->data->tagline))
129
        {
130 1
            return $this->data->tagline;
131
        }
132 1
        return '';
133
    }
134
135
    /**
136
     * Get collection id
137
     * @return int
138
     */
139 2
    public function getCollectionId(): int
140
    {
141 2
        if (!empty($this->data->belongs_to_collection))
142
        {
143 1
            return (int) $this->data->belongs_to_collection->id;
144
        }
145 1
        return 0;
146
    }
147
148
}
149