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) |
||
81 | |||
82 | /** |
||
83 | * Get the userid for a username from Kitsu |
||
84 | * |
||
85 | * @param string $username |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getUserIdByUsername(string $username = NULL) |
||
113 | |||
114 | /** |
||
115 | * Get the access token from the Kitsu API |
||
116 | * |
||
117 | * @param string $username |
||
118 | * @param string $password |
||
119 | * @return bool|string |
||
120 | */ |
||
121 | public function authenticate(string $username, string $password) |
||
141 | |||
142 | /** |
||
143 | * Get information about a particular anime |
||
144 | * |
||
145 | * @param string $slug |
||
146 | * @return array |
||
147 | */ |
||
148 | public function getAnime(string $slug): array |
||
154 | |||
155 | /** |
||
156 | * Get information about a particular anime |
||
157 | * |
||
158 | * @param string $animeId |
||
159 | * @return array |
||
160 | */ |
||
161 | public function getAnimeById(string $animeId): array |
||
166 | |||
167 | /** |
||
168 | * Get the mal id for the anime represented by the kitsu id |
||
169 | * to enable updating MyAnimeList |
||
170 | * |
||
171 | * @param string $kitsuAnimeId The id of the anime on Kitsu |
||
172 | * @return string|null Returns the mal id if it exists, otherwise null |
||
173 | */ |
||
174 | public function getMalIdForAnime(string $kitsuAnimeId) |
||
194 | |||
195 | /** |
||
196 | * Get information about a particular manga |
||
197 | * |
||
198 | * @param string $mangaId |
||
199 | * @return array |
||
200 | */ |
||
201 | public function getManga(string $mangaId): array |
||
206 | |||
207 | /** |
||
208 | * Get and transform the entirety of the user's anime list |
||
209 | * |
||
210 | * @return array |
||
211 | */ |
||
212 | public function getFullAnimeList(): array |
||
216 | |||
217 | /** |
||
218 | * Get the raw (unorganized) anime list for the configured user |
||
219 | * |
||
220 | * @param string $status - The watching status to filter the list with |
||
221 | * @param int $limit - The number of list entries to fetch for a page |
||
222 | * @param int $offset - The page offset |
||
223 | * @return array |
||
224 | */ |
||
225 | public function getRawAnimeList(string $status, int $limit = 600, int $offset = 0): array |
||
245 | |||
246 | /** |
||
247 | * Get the anime list for the configured user |
||
248 | * |
||
249 | * @param string $status - The watching status to filter the list with |
||
250 | * @param int $limit - The number of list entries to fetch for a page |
||
251 | * @param int $offset - The page offset |
||
252 | * @return array |
||
253 | */ |
||
254 | public function getAnimeList(string $status, int $limit = 600, int $offset = 0): array |
||
276 | |||
277 | /** |
||
278 | * Get the manga list for the configured user |
||
279 | * |
||
280 | * @param string $status - The reading status by which to filter the list |
||
281 | * @param int $limit - The number of list items to fetch per page |
||
282 | * @param int $offset - The page offset |
||
283 | * @return array |
||
284 | */ |
||
285 | public function getMangaList(string $status, int $limit = 200, int $offset = 0): array |
||
318 | |||
319 | /** |
||
320 | * Search for an anime or manga |
||
321 | * |
||
322 | * @param string $type - 'anime' or 'manga' |
||
323 | * @param string $query - name of the item to search for |
||
324 | * @return array |
||
325 | */ |
||
326 | public function search(string $type, string $query): array |
||
350 | |||
351 | /** |
||
352 | * Create a list item |
||
353 | * |
||
354 | * @param array $data |
||
355 | * @return Request |
||
356 | */ |
||
357 | public function createListItem(array $data): Request |
||
362 | |||
363 | /** |
||
364 | * Get the data for a specific list item, generally for editing |
||
365 | * |
||
366 | * @param string $listId - The unique identifier of that list item |
||
367 | * @return array |
||
368 | */ |
||
369 | public function getListItem(string $listId): array |
||
392 | |||
393 | /** |
||
394 | * Modify a list item |
||
395 | * |
||
396 | * @param array $data |
||
397 | * @return Request |
||
398 | */ |
||
399 | public function updateListItem(array $data): Request |
||
403 | |||
404 | /** |
||
405 | * Remove a list item |
||
406 | * |
||
407 | * @param string $id - The id of the list item to remove |
||
408 | * @return Request |
||
409 | */ |
||
410 | public function deleteListItem(string $id): Request |
||
414 | |||
415 | private function getUsername(): string |
||
421 | |||
422 | private function getRawMediaDataById(string $type, string $id): array |
||
437 | |||
438 | private function getRawMediaData(string $type, string $slug): array |
||
456 | } |
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..