Minor api model refactoring
This commit is contained in:
parent
754a5e7b98
commit
4f528ca2c8
@ -21,6 +21,13 @@ namespace Aviat\AnimeClient\Model;
|
|||||||
*/
|
*/
|
||||||
class API extends AbstractModel {
|
class API extends AbstractModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to use the MAL api
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $useMALAPI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the list entries by their title
|
* Sort the list entries by their title
|
||||||
*
|
*
|
||||||
|
@ -39,13 +39,6 @@ class Anime extends API {
|
|||||||
*/
|
*/
|
||||||
protected $malModel;
|
protected $malModel;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether to use the MAL api
|
|
||||||
*
|
|
||||||
* @var boolean
|
|
||||||
*/
|
|
||||||
protected $useMALAPI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Anime constructor.
|
* Anime constructor.
|
||||||
*
|
*
|
||||||
@ -53,10 +46,10 @@ class Anime extends API {
|
|||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container)
|
public function __construct(ContainerInterface $container)
|
||||||
{
|
{
|
||||||
$config = $container->get('config');
|
|
||||||
$this->kitsuModel = $container->get('kitsu-model');
|
$this->kitsuModel = $container->get('kitsu-model');
|
||||||
$this->malModel = $container->get('mal-model');
|
$this->malModel = $container->get('mal-model');
|
||||||
|
|
||||||
|
$config = $container->get('config');
|
||||||
$this->useMALAPI = $config->get(['use_mal_api']) === TRUE;
|
$this->useMALAPI = $config->get(['use_mal_api']) === TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,11 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\Enum\MangaReadingStatus\Title;
|
use Aviat\AnimeClient\API\{
|
||||||
use Aviat\AnimeClient\API\Mapping\MangaReadingStatus;
|
Enum\MangaReadingStatus\Title,
|
||||||
|
Mapping\MangaReadingStatus,
|
||||||
|
ParallelAPIRequest
|
||||||
|
};
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,6 +49,9 @@ class Manga extends API
|
|||||||
{
|
{
|
||||||
$this->kitsuModel = $container->get('kitsu-model');
|
$this->kitsuModel = $container->get('kitsu-model');
|
||||||
$this->malModel = $container->get('mal-model');
|
$this->malModel = $container->get('mal-model');
|
||||||
|
|
||||||
|
$config = $container->get('config');
|
||||||
|
$this->useMALAPI = $config->get(['use_mal_api']) === TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +66,7 @@ class Manga extends API
|
|||||||
{
|
{
|
||||||
return $this->kitsuModel->getFullOrganizedMangaList();
|
return $this->kitsuModel->getFullOrganizedMangaList();
|
||||||
}
|
}
|
||||||
|
|
||||||
$APIstatus = MangaReadingStatus::TITLE_TO_KITSU[$status];
|
$APIstatus = MangaReadingStatus::TITLE_TO_KITSU[$status];
|
||||||
$data = $this->kitsuModel->getMangaList($APIstatus);
|
$data = $this->kitsuModel->getMangaList($APIstatus);
|
||||||
return $this->mapByStatus($data)[$status];
|
return $this->mapByStatus($data)[$status];
|
||||||
|
Loading…
Reference in New Issue
Block a user