Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
3 changed files with 17 additions and 11 deletions
Showing only changes of commit 4f528ca2c8 - Show all commits

View File

@ -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
* *

View File

@ -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;
} }

View File

@ -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];