1 | <?php |
||
14 | class Movie extends AbstractModel |
||
15 | { |
||
16 | /** |
||
17 | * All known IMDb hostnames indexed by their language |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | public static $imdbHostnames = [ |
||
22 | 'en' => 'www.imdb.com', |
||
23 | 'fr' => 'www.imdb.fr', |
||
24 | 'de' => 'www.imdb.de', |
||
25 | 'es' => 'www.imdb.es', |
||
26 | 'it' => 'www.imdb.it', |
||
27 | 'pt' => 'www.imdb.pt', |
||
28 | 'akas' => 'akas.imdb.com', |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Extract IMDb id from URL |
||
33 | * |
||
34 | * @param string $string |
||
35 | * |
||
36 | * @return null|string the id extracted |
||
37 | */ |
||
38 | 2 | public static function extractId($string) |
|
47 | |||
48 | /** |
||
49 | * Returns the title, if needed fetch the title from IMDb |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | 1 | public function getTitle() |
|
62 | |||
63 | /** |
||
64 | * Fetch data from IMDb and store in database (possibly overwriting) |
||
65 | */ |
||
66 | public function fetchData(): void |
||
103 | |||
104 | /** |
||
105 | * Sets the ID for the movie from any string containing a valid ID |
||
106 | * |
||
107 | * @param string $id |
||
108 | * |
||
109 | * @return \mQueue\Model\Movie |
||
110 | */ |
||
111 | public function setId($id) |
||
122 | |||
123 | /** |
||
124 | * Returns the IMDb url for the movie |
||
125 | * |
||
126 | * @param string $lang suggested language for hostname |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | public function getImdbUrl($lang = null) |
||
144 | |||
145 | /** |
||
146 | * Returns the status for this movie and the specified user |
||
147 | * |
||
148 | * @param \mQueue\Model\User $user |
||
149 | * |
||
150 | * @return \mQueue\Model\Status |
||
151 | */ |
||
152 | public function getStatus(User $user = null) |
||
156 | |||
157 | /** |
||
158 | * Set the status for the specified user |
||
159 | * |
||
160 | * @param \mQueue\Model\User $user |
||
161 | * @param int $rating @see \mQueue\Model\Status |
||
162 | * |
||
163 | * @return \mQueue\Model\Status |
||
164 | */ |
||
165 | public function setStatus(User $user, $rating) |
||
171 | |||
172 | /** |
||
173 | * Set the source for the movie if any. In any case record the search date and count |
||
174 | * |
||
175 | * @param array|false $source |
||
176 | */ |
||
177 | public function setSource($source): void |
||
188 | } |
||
189 |
PHP provides two ways to mark string literals. Either with single quotes
'literal'
or with double quotes"literal"
. The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (
\'
) and the backslash (\\
). Every other character is displayed as is.Double quoted string literals may contain other variables or more complex escape sequences.
will print an indented:
Single is Value
If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.
For more information on PHP string literals and available escape sequences see the PHP core documentation.