1
|
|
|
<?php declare(strict_types = 1); |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Tmdb package. |
5
|
|
|
* |
6
|
|
|
* (c) Vincent Faliès <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @author Vincent Faliès <[email protected]> |
12
|
|
|
* @copyright Copyright (c) 2017 |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace VfacTmdb\Results; |
16
|
|
|
|
17
|
|
|
use VfacTmdb\Abstracts\Results; |
18
|
|
|
use VfacTmdb\Interfaces\TmdbInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class to manipulate a people movie cast result |
22
|
|
|
* @package Tmdb |
23
|
|
|
* @author Vincent Faliès <[email protected]> |
24
|
|
|
* @copyright Copyright (c) 2017 |
25
|
|
|
*/ |
26
|
|
View Code Duplication |
class PeopleMovieCast extends Results |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Adult |
31
|
|
|
* @var bool |
32
|
|
|
*/ |
33
|
|
|
protected $adult = false; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Character name |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $character = null; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Credit Id |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $credit_id = null; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* title |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected $title = null; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Image poster path |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
protected $poster_path = null; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* original title |
61
|
|
|
* @var string |
62
|
|
|
*/ |
63
|
|
|
protected $original_title = null; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Release date |
67
|
|
|
* @var string |
68
|
|
|
*/ |
69
|
|
|
protected $release_date = null; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Id |
73
|
|
|
* @var int |
74
|
|
|
*/ |
75
|
|
|
protected $id = null; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Constructor |
79
|
|
|
* @param TmdbInterface $tmdb |
80
|
|
|
* @param \stdClass $result |
81
|
|
|
*/ |
82
|
9 |
|
public function __construct(TmdbInterface $tmdb, \stdClass $result) |
83
|
|
|
{ |
84
|
9 |
|
parent::__construct($tmdb, $result); |
85
|
|
|
|
86
|
9 |
|
$this->id = $this->data->id; |
87
|
9 |
|
$this->adult = $this->data->adult; |
88
|
9 |
|
$this->character = $this->data->character; |
89
|
9 |
|
$this->credit_id = $this->data->credit_id; |
90
|
9 |
|
$this->original_title = $this->data->original_title; |
91
|
9 |
|
$this->title = $this->data->title; |
92
|
9 |
|
$this->poster_path = $this->data->poster_path; |
93
|
9 |
|
$this->release_date = $this->data->release_date; |
94
|
9 |
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Get Id |
98
|
|
|
* @return int |
99
|
|
|
*/ |
100
|
1 |
|
public function getId() : int |
101
|
|
|
{ |
102
|
1 |
|
return (int) $this->id; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Get credit Id |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
1 |
|
public function getCreditId() : string |
110
|
|
|
{ |
111
|
1 |
|
return $this->credit_id; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Get character name |
116
|
|
|
* @return string |
117
|
|
|
*/ |
118
|
1 |
|
public function getCharacter() : string |
119
|
|
|
{ |
120
|
1 |
|
return $this->character; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* Get title |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
1 |
|
public function getTitle() : string |
128
|
|
|
{ |
129
|
1 |
|
return $this->title; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Get original title |
134
|
|
|
* @return string |
135
|
|
|
*/ |
136
|
1 |
|
public function getOriginalTitle() : string |
137
|
|
|
{ |
138
|
1 |
|
return $this->original_title; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Get poster path |
143
|
|
|
* @return string |
144
|
|
|
*/ |
145
|
1 |
|
public function getPosterPath() : string |
146
|
|
|
{ |
147
|
1 |
|
return $this->poster_path; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* Get release date |
152
|
|
|
* @return string |
153
|
|
|
*/ |
154
|
1 |
|
public function getReleaseDate() : string |
155
|
|
|
{ |
156
|
1 |
|
return $this->release_date; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Adult |
161
|
|
|
* @return bool |
162
|
|
|
*/ |
163
|
1 |
|
public function getAdult() : bool |
164
|
|
|
{ |
165
|
1 |
|
return $this->adult; |
166
|
|
|
} |
167
|
|
|
} |
168
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.