Version 5.1 - All the GraphQL #32
@ -14,14 +14,14 @@
|
||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||
*/
|
||||
|
||||
namespace Aviat\AnimeClient\API\Kitsu\Enum;
|
||||
namespace Aviat\AnimeClient\API\Enum\AnimeWatchingStatus;
|
||||
|
||||
use Aviat\Ion\Enum as BaseEnum;
|
||||
use Aviat\Ion\Enum;
|
||||
|
||||
/**
|
||||
* Possible values for watching status for the current anime
|
||||
*/
|
||||
class AnimeWatchingStatus extends BaseEnum {
|
||||
class Kitsu extends Enum {
|
||||
const WATCHING = 'current';
|
||||
const PLAN_TO_WATCH = 'planned';
|
||||
const COMPLETED = 'completed';
|
@ -14,14 +14,14 @@
|
||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||
*/
|
||||
|
||||
namespace Aviat\AnimeClient\API\MAL\Enum;
|
||||
namespace Aviat\AnimeClient\API\Enum\AnimeWatchingStatus;
|
||||
|
||||
use Aviat\Ion\Enum as BaseEnum;
|
||||
use Aviat\Ion\Enum;
|
||||
|
||||
/**
|
||||
* Possible values for watching status for the current anime
|
||||
*/
|
||||
class AnimeWatchingStatus extends BaseEnum {
|
||||
class MAL extends Enum {
|
||||
const WATCHING = 1;
|
||||
const COMPLETED = 2;
|
||||
const ON_HOLD = 3;
|
@ -14,18 +14,17 @@
|
||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||
*/
|
||||
|
||||
namespace Aviat\AnimeClient\API\Kitsu\Enum;
|
||||
namespace Aviat\AnimeClient\API\Enum\MangaReadingStatus;
|
||||
|
||||
use Aviat\Ion\Enum as BaseEnum;
|
||||
use Aviat\Ion\Enum;
|
||||
|
||||
/**
|
||||
* Possible values for current reading status of manga
|
||||
*/
|
||||
class MangaReadingStatus extends BaseEnum {
|
||||
class Kitsu extends Enum {
|
||||
const READING = 'current';
|
||||
const PLAN_TO_READ = 'planned';
|
||||
const DROPPED = 'dropped';
|
||||
const ON_HOLD = 'on_hold';
|
||||
const COMPLETED = 'completed';
|
||||
}
|
||||
// End of MangaReadingStatus.php
|
@ -14,14 +14,14 @@
|
||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||
*/
|
||||
|
||||
namespace Aviat\AnimeClient\API\MAL\Enum;
|
||||
namespace Aviat\AnimeClient\API\Enum\MangaReadingStatus;
|
||||
|
||||
use Aviat\Ion\Enum as BaseEnum;
|
||||
use Aviat\Ion\Enum;
|
||||
|
||||
/**
|
||||
* Possible values for watching status for the current anime
|
||||
*/
|
||||
class MangaReadingStatus extends BaseEnum {
|
||||
class MAL extends Enum {
|
||||
const READING = 'reading';
|
||||
const COMPLETED = 'completed';
|
||||
const ON_HOLD = 'onhold';
|
@ -16,22 +16,13 @@
|
||||
|
||||
namespace Aviat\AnimeClient\API\MAL\Transformer;
|
||||
|
||||
use Aviat\AnimeClient\API\Kitsu\Enum\AnimeWatchingStatus;
|
||||
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
||||
use Aviat\Ion\Transformer\AbstractTransformer;
|
||||
|
||||
/**
|
||||
* Transformer for updating MAL List
|
||||
*/
|
||||
class AnimeListTransformer extends AbstractTransformer {
|
||||
|
||||
const STATUS_MAP = [
|
||||
AnimeWatchingStatus::WATCHING => '1',
|
||||
AnimeWatchingStatus::COMPLETED => '2',
|
||||
AnimeWatchingStatus::ON_HOLD => '3',
|
||||
AnimeWatchingStatus::DROPPED => '4',
|
||||
AnimeWatchingStatus::PLAN_TO_WATCH => '6'
|
||||
];
|
||||
|
||||
/**
|
||||
* Transform MAL episode data to Kitsu episode data
|
||||
*
|
||||
@ -45,7 +36,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
||||
return [
|
||||
'id' => $item['mal_id'],
|
||||
'data' => [
|
||||
'status' => self::STATUS_MAP[$item['watching_status']],
|
||||
'status' => AnimeWatchingStatus::KITSU_TO_MAL[$item['watching_status']],
|
||||
'rating' => $item['user_rating'],
|
||||
'rewatch_value' => (int) $rewatching,
|
||||
'times_rewatched' => $item['rewatched'],
|
||||
@ -93,7 +84,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
$map['data']['status'] = self::STATUS_MAP[$value];
|
||||
$map['data']['status'] = AnimeWatchingStatus::KITSU_TO_MAL[$value];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -15,10 +15,12 @@
|
||||
*/
|
||||
|
||||
namespace Aviat\AnimeClient\API\Mapping;
|
||||
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\{Route, Title};
|
||||
use Aviat\AnimeClient\API\{
|
||||
Kitsu\Enum\AnimeWatchingStatus as Kitsu,
|
||||
MAL\Enum\AnimeWatchingStatus as MAL
|
||||
|
||||
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\{
|
||||
Kitsu,
|
||||
MAL,
|
||||
Route,
|
||||
Title
|
||||
};
|
||||
use Aviat\Ion\Enum;
|
||||
|
||||
|
@ -16,11 +16,12 @@
|
||||
|
||||
namespace Aviat\AnimeClient\API\Mapping;
|
||||
|
||||
use Aviat\AnimeClient\API\{
|
||||
Kitsu\Enum\MangaReadingStatus as Kitsu,
|
||||
MAL\Enum\MangaReadingStatus as MAL
|
||||
use Aviat\AnimeClient\API\Enum\MangaReadingStatus\{
|
||||
Kitsu,
|
||||
MAL,
|
||||
Title,
|
||||
Route
|
||||
};
|
||||
use Aviat\AnimeClient\API\Enum\MangaReadingStatus\{Title, Route};
|
||||
use Aviat\Ion\Enum;
|
||||
|
||||
class MangaReadingStatus extends Enum {
|
||||
|
Loading…
Reference in New Issue
Block a user