Use more efficient method of combining large sets of data from Kitsu
This commit is contained in:
parent
c7a77a2eb5
commit
79be0ebb34
@ -26,7 +26,6 @@ use Aviat\AnimeClient\API\{
|
|||||||
ParallelAPIRequest
|
ParallelAPIRequest
|
||||||
};
|
};
|
||||||
use Aviat\AnimeClient\API\Enum\{
|
use Aviat\AnimeClient\API\Enum\{
|
||||||
AnimeWatchingStatus\Title,
|
|
||||||
AnimeWatchingStatus\Kitsu as KitsuWatchingStatus,
|
AnimeWatchingStatus\Kitsu as KitsuWatchingStatus,
|
||||||
MangaReadingStatus\Kitsu as KitsuReadingStatus
|
MangaReadingStatus\Kitsu as KitsuReadingStatus
|
||||||
};
|
};
|
||||||
@ -47,7 +46,7 @@ class Model {
|
|||||||
use ContainerAware;
|
use ContainerAware;
|
||||||
use KitsuTrait;
|
use KitsuTrait;
|
||||||
|
|
||||||
const LIST_PAGE_SIZE = 100;
|
protected const LIST_PAGE_SIZE = 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to map anime list items
|
* Class to map anime list items
|
||||||
@ -417,7 +416,7 @@ class Model {
|
|||||||
* @param array $options
|
* @param array $options
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getFullAnimeList(array $options = [
|
public function getFullRawAnimeList(array $options = [
|
||||||
'include' => 'anime.mappings'
|
'include' => 'anime.mappings'
|
||||||
]): array
|
]): array
|
||||||
{
|
{
|
||||||
@ -441,10 +440,10 @@ class Model {
|
|||||||
foreach($responses as $response)
|
foreach($responses as $response)
|
||||||
{
|
{
|
||||||
$data = Json::decode($response);
|
$data = Json::decode($response);
|
||||||
$output = array_merge_recursive($output, $data);
|
$output[] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return array_merge_recursive(...$output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -547,7 +546,7 @@ class Model {
|
|||||||
'sort' => '-updated_at'
|
'sort' => '-updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->getFullAnimeList($options);
|
return $this->getFullRawAnimeList($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@ -680,7 +679,7 @@ class Model {
|
|||||||
* @param array $options
|
* @param array $options
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getFullMangaList(array $options = [
|
public function getFullRawMangaList(array $options = [
|
||||||
'include' => 'manga.mappings'
|
'include' => 'manga.mappings'
|
||||||
]): array
|
]): array
|
||||||
{
|
{
|
||||||
@ -704,10 +703,10 @@ class Model {
|
|||||||
foreach($responses as $response)
|
foreach($responses as $response)
|
||||||
{
|
{
|
||||||
$data = Json::decode($response);
|
$data = Json::decode($response);
|
||||||
$output = array_merge_recursive($output, $data);
|
$output[] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return array_merge_recursive(...$output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user