1 | <?php |
||
14 | class Movie extends AbstractModel |
||
15 | { |
||
16 | /** |
||
17 | * All known IMDb hostnames indexed by their language |
||
18 | * @var array |
||
19 | */ |
||
20 | public static $imdbHostnames = [ |
||
21 | 'en' => 'www.imdb.com', |
||
22 | 'fr' => 'www.imdb.fr', |
||
23 | 'de' => 'www.imdb.de', |
||
24 | 'es' => 'www.imdb.es', |
||
25 | 'it' => 'www.imdb.it', |
||
26 | 'pt' => 'www.imdb.pt', |
||
27 | 'akas' => 'akas.imdb.com', |
||
28 | ]; |
||
29 | |||
30 | /** |
||
31 | * Extract IMDb id from URL |
||
32 | * @param string $string |
||
33 | * @return null|string the id extracted |
||
34 | */ |
||
35 | 2 | public static function extractId($string) |
|
44 | |||
45 | /** |
||
46 | * Returns the title, if needed fetch the title from IMDb |
||
47 | * @return string |
||
48 | */ |
||
49 | 1 | public function getTitle() |
|
58 | |||
59 | /** |
||
60 | * Fetch data from IMDb and store in database (possibly overwriting) |
||
61 | */ |
||
62 | public function fetchData() |
||
98 | |||
99 | /** |
||
100 | * Sets the ID for the movie from any string containing a valid ID |
||
101 | * @param string $id |
||
102 | * @return \mQueue\Model\Movie |
||
103 | */ |
||
104 | public function setId($id) |
||
115 | |||
116 | /** |
||
117 | * Returns the IMDb url for the movie |
||
118 | * @param string $lang suggested language for hostname |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getImdbUrl($lang = null) |
||
135 | |||
136 | /** |
||
137 | * Returns the status for this movie and the specified user |
||
138 | * @param \mQueue\Model\User $user |
||
139 | * @return \mQueue\Model\Status |
||
140 | */ |
||
141 | public function getStatus(User $user = null) |
||
145 | |||
146 | /** |
||
147 | * Set the status for the specified user |
||
148 | * @param \mQueue\Model\User $user |
||
149 | * @param int $rating @see \mQueue\Model\Status |
||
150 | * @return \mQueue\Model\Status |
||
151 | */ |
||
152 | public function setStatus(User $user, $rating) |
||
158 | |||
159 | /** |
||
160 | * Set the source for the movie if any. In any case record the search date and count |
||
161 | * @param array|false $source |
||
162 | */ |
||
163 | public function setSource($source) |
||
174 | } |
||
175 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.