1 | <?php declare(strict_types=1); |
||
35 | class Model { |
||
36 | use CacheTrait; |
||
37 | use ContainerAware; |
||
38 | use KitsuTrait; |
||
39 | |||
40 | /** |
||
41 | * Class to map anime list items |
||
42 | * to a common format used by |
||
43 | * templates |
||
44 | * |
||
45 | * @var AnimeListTransformer |
||
46 | */ |
||
47 | protected $animeListTransformer; |
||
48 | |||
49 | /** |
||
50 | * @var AnimeTransformer |
||
51 | */ |
||
52 | protected $animeTransformer; |
||
53 | |||
54 | /** |
||
55 | * @var ListItem |
||
56 | */ |
||
57 | protected $listItem; |
||
58 | |||
59 | /** |
||
60 | * @var MangaTransformer |
||
61 | */ |
||
62 | protected $mangaTransformer; |
||
63 | |||
64 | /** |
||
65 | * @var MangaListTransformer |
||
66 | */ |
||
67 | protected $mangaListTransformer; |
||
68 | |||
69 | |||
70 | /** |
||
71 | * Constructor. |
||
72 | */ |
||
73 | public function __construct(ListItem $listItem) |
||
84 | |||
85 | /** |
||
86 | * Get the userid for a username from Kitsu |
||
87 | * |
||
88 | * @param string $username |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getUserIdByUsername(string $username = NULL) |
||
116 | |||
117 | /** |
||
118 | * Get the access token from the Kitsu API |
||
119 | * |
||
120 | * @param string $username |
||
121 | * @param string $password |
||
122 | * @return bool|string |
||
123 | */ |
||
124 | public function authenticate(string $username, string $password) |
||
144 | |||
145 | /** |
||
146 | * Get information about a particular anime |
||
147 | * |
||
148 | * @param string $slug |
||
149 | * @return array |
||
150 | */ |
||
151 | public function getAnime(string $slug): array |
||
157 | |||
158 | /** |
||
159 | * Get information about a particular anime |
||
160 | * |
||
161 | * @param string $animeId |
||
162 | * @return array |
||
163 | */ |
||
164 | public function getAnimeById(string $animeId): array |
||
169 | |||
170 | /** |
||
171 | * Get the mal id for the anime represented by the kitsu id |
||
172 | * to enable updating MyAnimeList |
||
173 | * |
||
174 | * @param string $kitsuAnimeId The id of the anime on Kitsu |
||
175 | * @return string|null Returns the mal id if it exists, otherwise null |
||
176 | */ |
||
177 | public function getMalIdForAnime(string $kitsuAnimeId) |
||
197 | |||
198 | /** |
||
199 | * Get information about a particular manga |
||
200 | * |
||
201 | * @param string $mangaId |
||
202 | * @return array |
||
203 | */ |
||
204 | public function getManga(string $mangaId): array |
||
209 | |||
210 | /** |
||
211 | * Get and transform the entirety of the user's anime list |
||
212 | * |
||
213 | * @return array |
||
214 | */ |
||
215 | public function getFullAnimeList(): array |
||
219 | |||
220 | /** |
||
221 | * Get the raw (unorganized) anime list for the configured user |
||
222 | * |
||
223 | * @param string $status - The watching status to filter the list with |
||
224 | * @param int $limit - The number of list entries to fetch for a page |
||
225 | * @param int $offset - The page offset |
||
226 | * @return array |
||
227 | */ |
||
228 | public function getRawAnimeList(string $status, int $limit = 600, int $offset = 0): array |
||
248 | |||
249 | /** |
||
250 | * Get the anime list for the configured user |
||
251 | * |
||
252 | * @param string $status - The watching status to filter the list with |
||
253 | * @param int $limit - The number of list entries to fetch for a page |
||
254 | * @param int $offset - The page offset |
||
255 | * @return array |
||
256 | */ |
||
257 | public function getAnimeList(string $status, int $limit = 600, int $offset = 0): array |
||
279 | |||
280 | /** |
||
281 | * Get the manga list for the configured user |
||
282 | * |
||
283 | * @param string $status - The reading status by which to filter the list |
||
284 | * @param int $limit - The number of list items to fetch per page |
||
285 | * @param int $offset - The page offset |
||
286 | * @return array |
||
287 | */ |
||
288 | public function getMangaList(string $status, int $limit = 200, int $offset = 0): array |
||
321 | |||
322 | /** |
||
323 | * Search for an anime or manga |
||
324 | * |
||
325 | * @param string $type - 'anime' or 'manga' |
||
326 | * @param string $query - name of the item to search for |
||
327 | * @return array |
||
328 | */ |
||
329 | public function search(string $type, string $query): array |
||
353 | |||
354 | /** |
||
355 | * Create a list item |
||
356 | * |
||
357 | * @param array $data |
||
358 | * @return bool |
||
359 | */ |
||
360 | public function createListItem(array $data): bool |
||
365 | |||
366 | /** |
||
367 | * Get the data for a specific list item, generally for editing |
||
368 | * |
||
369 | * @param string $listId - The unique identifier of that list item |
||
370 | * @return array |
||
371 | */ |
||
372 | public function getListItem(string $listId): array |
||
395 | |||
396 | /** |
||
397 | * Modify a list item |
||
398 | * |
||
399 | * @param array $data |
||
400 | * @return array |
||
401 | */ |
||
402 | public function updateListItem(array $data) |
||
420 | |||
421 | /** |
||
422 | * Remove a list item |
||
423 | * |
||
424 | * @param string $id - The id of the list item to remove |
||
425 | * @return bool |
||
426 | */ |
||
427 | public function deleteListItem(string $id): bool |
||
431 | |||
432 | private function getUsername(): string |
||
438 | |||
439 | private function getRawMediaDataById(string $type, string $id): array |
||
454 | |||
455 | private function getRawMediaData(string $type, string $slug): array |
||
473 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..