Merge pull request 'develop' (#37) from develop into master

Reviewed-on: timw4mail/HummingBirdAnimeClient#37
This commit is contained in:
Timothy Warren 2021-02-03 10:07:11 -05:00
commit df7a9e311b
202 changed files with 1413 additions and 1214 deletions

View File

@ -4,13 +4,12 @@ install:
- composer install --ignore-platform-reqs - composer install --ignore-platform-reqs
php: php:
- 7.4
- nightly - nightly
script: script:
- mkdir -p build/logs - mkdir -p build/logs
- php vendor/bin/phpunit -c build - php vendor/bin/phpunit -c build
matrix: #matrix:
allow_failures: # allow_failures:
- php: nightly # - php: nightly

6
Jenkinsfile vendored
View File

@ -10,10 +10,10 @@ pipeline {
sh 'php composer.phar install --ignore-platform-reqs' sh 'php composer.phar install --ignore-platform-reqs'
} }
} }
stage('PHP 7.4') { stage('PHP 8') {
agent { agent {
docker { docker {
image 'php:7.4-alpine' image 'php:8-cli-alpine'
args '-u root --privileged' args '-u root --privileged'
} }
} }
@ -25,7 +25,7 @@ pipeline {
stage('Latest PHP') { stage('Latest PHP') {
agent { agent {
docker { docker {
image 'php:alpine' image 'php:cli-alpine'
args '-u root --privileged' args '-u root --privileged'
} }
} }

View File

@ -30,7 +30,7 @@ class RoboFile extends Tasks {
* *
* @var array * @var array
*/ */
protected $taskDirs = [ protected array $taskDirs = [
'build/logs', 'build/logs',
'build/pdepend', 'build/pdepend',
'build/phpdox', 'build/phpdox',
@ -41,7 +41,7 @@ class RoboFile extends Tasks {
* *
* @var array * @var array
*/ */
protected $cleanDirs = [ protected array $cleanDirs = [
'coverage', 'coverage',
'docs', 'docs',
'phpdoc', 'phpdoc',

View File

@ -14,7 +14,7 @@
* @link https://github.com/timw4mail/HummingBirdAnimeClient * @link https://github.com/timw4mail/HummingBirdAnimeClient
*/ */
use function Aviat\AnimeClient\loadToml; use function Aviat\AnimeClient\loadConfig;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Lower level configuration // Lower level configuration
@ -24,7 +24,7 @@ use function Aviat\AnimeClient\loadToml;
$APP_DIR = realpath(__DIR__ . '/../'); $APP_DIR = realpath(__DIR__ . '/../');
$ROOT_DIR = realpath("{$APP_DIR}/../"); $ROOT_DIR = realpath("{$APP_DIR}/../");
$tomlConfig = loadToml(__DIR__); $tomlConfig = loadConfig(__DIR__);
return array_merge($tomlConfig, [ return array_merge($tomlConfig, [
'asset_dir' => "{$ROOT_DIR}/public", 'asset_dir' => "{$ROOT_DIR}/public",

View File

@ -51,6 +51,10 @@ $routes = [
'action' => 'add', 'action' => 'add',
'verb' => 'post', 'verb' => 'post',
], ],
'anime.random' => [
'path' => '/anime/details/random',
'action' => 'random',
],
'anime.details' => [ 'anime.details' => [
'path' => '/anime/details/{id}', 'path' => '/anime/details/{id}',
'action' => 'details', 'action' => 'details',
@ -84,6 +88,10 @@ $routes = [
'action' => 'delete', 'action' => 'delete',
'verb' => 'post', 'verb' => 'post',
], ],
'manga.random' => [
'path' => '/manga/details/random',
'action' => 'random',
],
'manga.details' => [ 'manga.details' => [
'path' => '/manga/details/{id}', 'path' => '/manga/details/{id}',
'action' => 'details', 'action' => 'details',
@ -247,6 +255,13 @@ $routes = [
'path' => '/logout', 'path' => '/logout',
'action' => 'logout', 'action' => 'logout',
], ],
'history' => [
'controller' => 'history',
'path' => '/history/{type}',
'tokens' => [
'type' => SLUG_PATTERN
]
],
'increment' => [ 'increment' => [
'path' => '/{controller}/increment', 'path' => '/{controller}/increment',
'action' => 'increment', 'action' => 'increment',
@ -280,19 +295,12 @@ $routes = [
], ],
], ],
'list' => [ 'list' => [
'path' => '/{controller}/{type}{/view}', 'path' => '/{controller}/{status}{/view}',
'tokens' => [ 'tokens' => [
'type' => ALPHA_SLUG_PATTERN, 'status' => ALPHA_SLUG_PATTERN,
'view' => ALPHA_SLUG_PATTERN, 'view' => ALPHA_SLUG_PATTERN,
], ],
], ],
'history' => [
'controller' => 'history',
'path' => '/history/{type}',
'tokens' => [
'type' => SLUG_PATTERN
]
],
'index_redirect' => [ 'index_redirect' => [
'path' => '/', 'path' => '/',
'action' => 'redirectToDefaultRoute', 'action' => 'redirectToDefaultRoute',

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -32,10 +32,13 @@ use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger; use Monolog\Logger;
use Psr\SimpleCache\CacheInterface; use Psr\SimpleCache\CacheInterface;
use function Aviat\Ion\_dir;
if ( ! defined('APP_DIR')) if ( ! defined('APP_DIR'))
{ {
define('APP_DIR', __DIR__); define('APP_DIR', __DIR__);
define('TEMPLATE_DIR', APP_DIR . '/templates'); define('ROOT_DIR', dirname(APP_DIR));
define('TEMPLATE_DIR', _dir(APP_DIR, 'templates'));
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -47,15 +50,16 @@ return static function (array $configArray = []): Container {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Logging // Logging
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
$LOG_DIR = _dir(APP_DIR, 'logs');
$appLogger = new Logger('animeclient'); $appLogger = new Logger('animeclient');
$appLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/app.log', 2, Logger::WARNING)); $appLogger->pushHandler(new RotatingFileHandler(_dir($LOG_DIR, 'app.log'), 2, Logger::WARNING));
$container->setLogger($appLogger); $container->setLogger($appLogger);
foreach (['anilist-request', 'kitsu-request', 'kitsu-graphql'] as $channel) foreach (['anilist-request', 'kitsu-request', 'kitsu-graphql'] as $channel)
{ {
$logger = new Logger($channel); $logger = new Logger($channel);
$handler = new RotatingFileHandler(__DIR__ . "/logs/{$channel}.log", 2, Logger::WARNING); $handler = new RotatingFileHandler(_dir($LOG_DIR, "{$channel}.log"), 2, Logger::WARNING);
$handler->setFormatter(new JsonFormatter()); $handler->setFormatter(new JsonFormatter());
$logger->pushHandler($handler); $logger->pushHandler($handler);
@ -67,7 +71,7 @@ return static function (array $configArray = []): Container {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Create Config Object // Create Config Object
$container->set('config', fn () => new Config($configArray)); $container->set('config', static fn () => new Config($configArray));
// Create Cache Object // Create Cache Object
$container->set('cache', static function(ContainerInterface $container): CacheInterface { $container->set('cache', static function(ContainerInterface $container): CacheInterface {
@ -77,7 +81,7 @@ return static function (array $configArray = []): Container {
}); });
// Create Aura Router Object // Create Aura Router Object
$container->set('aura-router', fn() => new RouterContainer); $container->set('aura-router', static fn() => new RouterContainer);
// Create Html helpers // Create Html helpers
$container->set('html-helper', static function(ContainerInterface $container) { $container->set('html-helper', static function(ContainerInterface $container) {
@ -125,8 +129,8 @@ return static function (array $configArray = []): Container {
}); });
// Create Request Object // Create Request Object
$container->set('request', fn () => ServerRequestFactory::fromGlobals( $container->set('request', static fn () => ServerRequestFactory::fromGlobals(
$_SERVER, $GLOBALS['_SERVER'],
$_GET, $_GET,
$_POST, $_POST,
$_COOKIE, $_COOKIE,
@ -134,10 +138,10 @@ return static function (array $configArray = []): Container {
)); ));
// Create session Object // Create session Object
$container->set('session', fn () => (new SessionFactory())->newInstance($_COOKIE)); $container->set('session', static fn () => (new SessionFactory())->newInstance($_COOKIE));
// Miscellaneous helper methods // Miscellaneous helper methods
$container->set('util', fn ($container) => new Util($container)); $container->set('util', static fn ($container) => new Util($container));
// Models // Models
$container->set('kitsu-model', static function(ContainerInterface $container): Kitsu\Model { $container->set('kitsu-model', static function(ContainerInterface $container): Kitsu\Model {
@ -170,10 +174,10 @@ return static function (array $configArray = []): Container {
return $model; return $model;
}); });
$container->set('anime-model', fn ($container) => new Model\Anime($container)); $container->set('anime-model', static fn ($container) => new Model\Anime($container));
$container->set('manga-model', fn ($container) => new Model\Manga($container)); $container->set('manga-model', static fn ($container) => new Model\Manga($container));
$container->set('anime-collection-model', fn ($container) => new Model\AnimeCollection($container)); $container->set('anime-collection-model', static fn ($container) => new Model\AnimeCollection($container));
$container->set('manga-collection-model', fn ($container) => new Model\MangaCollection($container)); $container->set('manga-collection-model', static fn ($container) => new Model\MangaCollection($container));
$container->set('settings-model', static function($container) { $container->set('settings-model', static function($container) {
$model = new Model\Settings($container->get('config')); $model = new Model\Settings($container->get('config'));
$model->setContainer($container); $model->setContainer($container);
@ -181,13 +185,13 @@ return static function (array $configArray = []): Container {
}); });
// Miscellaneous Classes // Miscellaneous Classes
$container->set('auth', fn ($container) => new Kitsu\Auth($container)); $container->set('auth', static fn ($container) => new Kitsu\Auth($container));
$container->set('url-generator', fn ($container) => new UrlGenerator($container)); $container->set('url-generator', static fn ($container) => new UrlGenerator($container));
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Dispatcher // Dispatcher
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
$container->set('dispatcher', fn ($container) => new Dispatcher($container)); $container->set('dispatcher', static fn ($container) => new Dispatcher($container));
return $container; return $container;
}; };

View File

@ -18,7 +18,7 @@
</a> </a>
</div> </div>
<div class="table"> <div class="table">
<?php if ($item['private'] || $item['rewatching']): ?> <?php if (isset($item['private']) || isset($item['rewatching'])): ?>
<div class="row"> <div class="row">
<?php foreach (['private', 'rewatching'] as $attr): ?> <?php foreach (['private', 'rewatching'] as $attr): ?>
<?php if ($item[$attr]): ?> <?php if ($item[$attr]): ?>

View File

@ -5,8 +5,8 @@ namespace Aviat\AnimeClient;
$whose = $config->get('whose_list') . "'s "; $whose = $config->get('whose_list') . "'s ";
$lastSegment = $urlGenerator->lastSegment(); $lastSegment = $urlGenerator->lastSegment();
$extraSegment = $lastSegment === 'list' ? '/list' : ''; $extraSegment = $lastSegment === 'list' ? '/list' : '';
$hasAnime = stripos($_SERVER['REQUEST_URI'], 'anime') !== FALSE; $hasAnime = stripos($GLOBALS['_SERVER']['REQUEST_URI'], 'anime') !== FALSE;
$hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') !== FALSE; $hasManga = stripos($GLOBALS['_SERVER']['REQUEST_URI'], 'manga') !== FALSE;
?> ?>
<div id="main-nav" class="flex flex-align-end flex-wrap"> <div id="main-nav" class="flex flex-align-end flex-wrap">
@ -84,7 +84,7 @@ $hasManga = stripos($_SERVER['REQUEST_URI'], 'manga') !== FALSE;
<?php if ($container->get('util')->isViewPage() && ($hasAnime || $hasManga)): ?> <?php if ($container->get('util')->isViewPage() && ($hasAnime || $hasManga)): ?>
<nav> <nav>
<?= $helper->menu($menu_name) ?> <?= $helper->menu($menu_name) ?>
<?php if (stripos($_SERVER['REQUEST_URI'], 'history') === FALSE): ?> <?php if (stripos($GLOBALS['_SERVER']['REQUEST_URI'], 'history') === FALSE): ?>
<br /> <br />
<ul> <ul>
<?php $currentView = Util::eq('list', $lastSegment) ? 'list' : 'cover' ?> <?php $currentView = Util::eq('list', $lastSegment) ? 'list' : 'cover' ?>

View File

@ -3,13 +3,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -1,24 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" stopOnFailure="false" bootstrap="../tests/bootstrap.php" beStrictAboutTestsThatDoNotTestAnything="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
colors="true" <coverage>
stopOnFailure="false" <include>
bootstrap="../tests/bootstrap.php"
beStrictAboutTestsThatDoNotTestAnything="true"
>
<filter>
<whitelist>
<directory suffix=".php">../src</directory> <directory suffix=".php">../src</directory>
</whitelist> </include>
</filter> <report>
<clover outputFile="logs/clover.xml"/>
<html outputDirectory="../coverage"/>
</report>
</coverage>
<testsuites> <testsuites>
<testsuite name="AnimeClient"> <testsuite name="AnimeClient">
<directory>../tests</directory> <directory>../tests/AnimeClient</directory>
</testsuite>
<testsuite name="Ion">
<directory>../tests/Ion</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<logging> <logging/>
<log type="coverage-html" target="../coverage"/>
<log type="coverage-clover" target="logs/clover.xml"/>
</logging>
<php> <php>
<server name="HTTP_USER_AGENT" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0"/> <server name="HTTP_USER_AGENT" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0"/>
<server name="HTTP_HOST" value="localhost"/> <server name="HTTP_HOST" value="localhost"/>

View File

@ -30,7 +30,7 @@
"config": { "config": {
"lock": false, "lock": false,
"platform": { "platform": {
"php": "7.4" "php": "8"
} }
}, },
"require": { "require": {
@ -48,31 +48,30 @@
"ext-json": "*", "ext-json": "*",
"ext-gd": "*", "ext-gd": "*",
"ext-pdo": "*", "ext-pdo": "*",
"laminas/laminas-diactoros": "^2.2.3", "filp/whoops": "^2.1",
"laminas/laminas-diactoros": "^2.5.0",
"laminas/laminas-httphandlerrunner": "^1.1.0", "laminas/laminas-httphandlerrunner": "^1.1.0",
"maximebf/consolekit": "^1.0.3", "maximebf/consolekit": "^1.0.3",
"monolog/monolog": "^2.0.2", "monolog/monolog": "^2.0.2",
"php": ">=7.4", "php": "^8.0.0",
"psr/container": "^1.0.0", "psr/container": "^1.0.0",
"psr/http-message": "^1.0.1", "psr/http-message": "^1.0.1",
"psr/log": "^1.1.3", "psr/log": "^1.1.3",
"robmorgan/phinx": "^0.12.4",
"symfony/var-dumper": "^5.0.7",
"yosymfony/toml": "^1.0.4" "yosymfony/toml": "^1.0.4"
}, },
"require-dev": { "require-dev": {
"consolidation/robo": "^2.0.0", "consolidation/robo": "^2.0.0",
"filp/whoops": "^2.1",
"pdepend/pdepend": "^2.", "pdepend/pdepend": "^2.",
"phploc/phploc": "^5.0.0", "phploc/phploc": "^7.0.0",
"phpmd/phpmd": "^2.8.2", "phpmd/phpmd": "^2.8.2",
"phpstan/phpstan": "^0.12.19", "phpstan/phpstan": "^0.12.19",
"phpunit/phpunit": "^8.5.2", "phpunit/phpunit": "^9.5.0",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"robmorgan/phinx": "^0.12.4", "sebastian/phpcpd": "^6.0.0",
"sebastian/phpcpd": "^4.1.0",
"spatie/phpunit-snapshot-assertions": "^4.1.0", "spatie/phpunit-snapshot-assertions": "^4.1.0",
"squizlabs/php_codesniffer": "^3.5.4", "squizlabs/php_codesniffer": "^3.5.4"
"symfony/var-dumper": "^5.0.7",
"theseer/phpdox": "^0.12.0"
}, },
"scripts": { "scripts": {
"build": "vendor/bin/robo build", "build": "vendor/bin/robo build",

View File

@ -7,7 +7,7 @@ require_once __DIR__ . '/vendor/autoload.php';
use Aviat\AnimeClient\Command; use Aviat\AnimeClient\Command;
use ConsoleKit\Console; use ConsoleKit\Console;
$_SERVER['HTTP_HOST'] = 'localhost'; $GLOBALS['_SERVER']['HTTP_HOST'] = 'localhost';
define('APP_DIR', __DIR__ . '/app'); define('APP_DIR', __DIR__ . '/app');
define('TEMPLATE_DIR', APP_DIR . '/templates'); define('TEMPLATE_DIR', APP_DIR . '/templates');

View File

@ -1,6 +1,6 @@
<?php <?php
$verb = strtolower($_SERVER['REQUEST_METHOD']); $verb = strtolower($GLOBALS['_SERVER']['REQUEST_METHOD']);
// Send request method if nothing else is specified // Send request method if nothing else is specified
if (empty($_GET)) if (empty($_GET))

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -45,7 +45,7 @@ $CONF_DIR = _dir($APP_DIR, 'config');
$baseConfig = require "{$APPCONF_DIR}/base_config.php"; $baseConfig = require "{$APPCONF_DIR}/base_config.php";
$di = require "{$APP_DIR}/bootstrap.php"; $di = require "{$APP_DIR}/bootstrap.php";
$config = loadToml($CONF_DIR); $config = loadConfig($CONF_DIR);
$overrideFile = "{$CONF_DIR}/admin-override.toml"; $overrideFile = "{$CONF_DIR}/admin-override.toml";
$overrideConfig = file_exists($overrideFile) $overrideConfig = file_exists($overrideFile)

View File

@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" stopOnFailure="false" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
colors="true" <coverage>
stopOnFailure="false" <include>
bootstrap="tests/bootstrap.php"
>
<filter>
<whitelist>
<directory suffix=".php">src</directory> <directory suffix=".php">src</directory>
</whitelist> </include>
</filter> </coverage>
<testsuites> <testsuites>
<testsuite name="AnimeClient"> <testsuite name="AnimeClient">
<directory>tests</directory> <directory>tests/AnimeClient</directory>
</testsuite>
<testsuite name="Ion">
<directory>tests/Ion</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<php> <php>

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -35,43 +35,36 @@ abstract class APIRequestBuilder {
/** /**
* Where to look for GraphQL request files * Where to look for GraphQL request files
* @var string
*/ */
protected string $filePath = __DIR__; protected string $filePath = '';
/** /**
* Url prefix for making url requests * Url prefix for making url requests
* @var string
*/ */
protected string $baseUrl = ''; protected string $baseUrl = '';
/** /**
* Url path of the request * Url path of the request
* @var string
*/ */
protected string $path = ''; protected string $path = '';
/** /**
* Query string for the request * Query string for the request
* @var string
*/ */
protected string $query = ''; protected string $query = '';
/** /**
* Default request headers * Default request headers
* @var array
*/ */
protected array $defaultHeaders = []; protected array $defaultHeaders = [];
/** /**
* Valid HTTP request methods * Valid HTTP request methods
* @var array
*/ */
protected array $validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']; protected array $validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
/** /**
* The current request * The current request
* @var Request
*/ */
protected Request $request; protected Request $request;
@ -309,7 +302,7 @@ abstract class APIRequestBuilder {
*/ */
public function queryRequest(string $name, array $variables = []): Request public function queryRequest(string $name, array $variables = []): Request
{ {
$file = "{$this->filePath}/Queries/{$name}.graphql"; $file = realpath("{$this->filePath}/Queries/{$name}.graphql");
if ( ! file_exists($file)) if ( ! file_exists($file))
{ {
throw new LogicException('GraphQL query file does not exist.'); throw new LogicException('GraphQL query file does not exist.');

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -21,7 +21,7 @@ use function Amp\Promise\wait;
use InvalidArgumentException; use InvalidArgumentException;
use Amp\Http\Client\Request; use Amp\Http\Client\Request;
use Aviat\AnimeClient\API\Anilist; use Aviat\AnimeClient\Anilist;
use Aviat\AnimeClient\API\Mapping\{AnimeWatchingStatus, MangaReadingStatus}; use Aviat\AnimeClient\API\Mapping\{AnimeWatchingStatus, MangaReadingStatus};
use Aviat\AnimeClient\Types\FormItem; use Aviat\AnimeClient\Types\FormItem;
use Aviat\Ion\Json; use Aviat\Ion\Json;

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -18,7 +18,7 @@ namespace Aviat\AnimeClient\API\Anilist;
use Amp\Http\Client\Request; use Amp\Http\Client\Request;
use Amp\Http\Client\Response; use Amp\Http\Client\Response;
use Aviat\AnimeClient\API\Anilist; use Aviat\AnimeClient\Anilist;
use Aviat\Ion\Di\ContainerAware; use Aviat\Ion\Di\ContainerAware;
use Aviat\Ion\Di\ContainerInterface; use Aviat\Ion\Di\ContainerInterface;
use Aviat\Ion\Json; use Aviat\Ion\Json;

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -23,7 +23,6 @@ trait RequestBuilderTrait {
/** /**
* The request builder for the Anilist API * The request builder for the Anilist API
* @var RequestBuilder
*/ */
protected RequestBuilder $requestBuilder; protected RequestBuilder $requestBuilder;
@ -33,7 +32,7 @@ trait RequestBuilderTrait {
* @param RequestBuilder $requestBuilder * @param RequestBuilder $requestBuilder
* @return self * @return self
*/ */
public function setRequestBuilder($requestBuilder): self public function setRequestBuilder(RequestBuilder $requestBuilder): self
{ {
$this->requestBuilder = $requestBuilder; $this->requestBuilder = $requestBuilder;
return $this; return $this;

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -24,33 +24,15 @@ class MediaListEntry extends AbstractType {
*/ */
public $id; public $id;
/**
* @var string|null
*/
public ?string $notes; public ?string $notes;
/**
* @var bool
*/
public ?bool $private; public ?bool $private;
/**
* @var int
*/
public int $progress; public int $progress;
/**
* @var int
*/
public ?int $repeat; public ?int $repeat;
/**
* @var string
*/
public string $status; public string $status;
/**
* @var int
*/
public ?int $score; public ?int $score;
} }

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -33,7 +33,7 @@ use Aviat\AnimeClient\API\Kitsu\Transformer\{
MangaListTransformer, MangaListTransformer,
MangaTransformer MangaTransformer
}; };
use Aviat\AnimeClient\Enum\ListType; use Aviat\AnimeClient\Enum\MediaType;
use Aviat\AnimeClient\Kitsu as K; use Aviat\AnimeClient\Kitsu as K;
use Aviat\AnimeClient\Types\Anime; use Aviat\AnimeClient\Types\Anime;
use Aviat\AnimeClient\Types\MangaPage; use Aviat\AnimeClient\Types\MangaPage;
@ -256,6 +256,21 @@ final class Model {
return $this->animeTransformer->transform($baseData); return $this->animeTransformer->transform($baseData);
} }
public function getRandomAnime(): Anime
{
$baseData = $this->requestBuilder->runQuery('RandomMedia', [
'type' => 'ANIME'
]);
return $this->animeTransformer->transform($baseData);
}
public function getRandomLibraryAnime(string $status): Anime
{
// @TODO
return Anime::from([]);
}
/** /**
* Get information about a particular anime * Get information about a particular anime
* *
@ -310,7 +325,7 @@ final class Model {
if ($list === NULL) if ($list === NULL)
{ {
$data = $this->getList(ListType::ANIME, $status) ?? []; $data = $this->getList(MediaType::ANIME, $status) ?? [];
// Bail out on no data // Bail out on no data
if (empty($data)) if (empty($data))
@ -343,7 +358,7 @@ final class Model {
*/ */
public function getAnimeListCount(string $status = '') : int public function getAnimeListCount(string $status = '') : int
{ {
return $this->getListCount(ListType::ANIME, $status); return $this->getListCount(MediaType::ANIME, $status);
} }
/** /**
@ -392,6 +407,15 @@ final class Model {
return $this->mangaTransformer->transform($baseData); return $this->mangaTransformer->transform($baseData);
} }
public function getRandomManga(): MangaPage
{
$baseData = $this->requestBuilder->runQuery('RandomMedia', [
'type' => 'MANGA'
]);
return $this->mangaTransformer->transform($baseData);
}
/** /**
* Get information about a particular manga * Get information about a particular manga
* *
@ -444,7 +468,7 @@ final class Model {
if ($list === NULL) if ($list === NULL)
{ {
$data = $this->getList(ListType::MANGA, $status) ?? []; $data = $this->getList(MediaType::MANGA, $status) ?? [];
// Bail out on no data // Bail out on no data
if (empty($data)) if (empty($data))
@ -477,7 +501,7 @@ final class Model {
*/ */
public function getMangaListCount(string $status = '') : int public function getMangaListCount(string $status = '') : int
{ {
return $this->getListCount(ListType::MANGA, $status); return $this->getListCount(MediaType::MANGA, $status);
} }
/** /**

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -0,0 +1,134 @@
query ($type: MediaTypeEnum!) {
randomMedia(mediaType: $type, ageRatings: [G,PG,R]) {
id
ageRating
ageRatingGuide
posterImage {
original {
height
name
url
width
}
views {
height
name
url
width
}
}
categories(first: 100) {
nodes {
title
}
}
characters(first: 100) {
nodes {
character {
id
names {
alternatives
canonical
localized
}
image {
original {
height
name
url
width
}
}
slug
}
role
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
description
startDate
endDate
sfw
slug
mappings(first: 10) {
nodes {
externalId
externalSite
}
}
staff(first: 100) {
nodes {
person {
id
birthday
image {
original {
height
name
url
width
}
views {
height
name
url
width
}
}
names {
alternatives
canonical
localized
}
slug
}
role
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
status
titles {
alternatives
canonical
canonicalLocale
localized
}
...on Anime {
episodeCount
episodeLength
totalLength
season
streamingLinks(first: 10) {
nodes {
dubs
subs
regions
streamer {
id
siteName
}
url
}
}
subtype
totalLength
youtubeTrailerVideoId
}
...on Manga {
chapterCount
volumeCount
subtype
}
}
}

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -34,9 +34,7 @@ final class AnimeTransformer extends AbstractTransformer {
*/ */
public function transform($item): AnimePage public function transform($item): AnimePage
{ {
$base = array_key_exists('findAnimeBySlug', $item['data']) $base = $item['data']['findAnimeBySlug'] ?? $item['data']['findAnimeById'] ?? $item['data']['randomMedia'];
? $item['data']['findAnimeBySlug']
: $item['data']['findAnimeById'];
$characters = []; $characters = [];
$links = []; $links = [];
$staff = []; $staff = [];

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -34,10 +34,7 @@ final class MangaTransformer extends AbstractTransformer {
*/ */
public function transform($item): MangaPage public function transform($item): MangaPage
{ {
$base = array_key_exists('findMangaBySlug', $item['data']) $base = $item['data']['findMangaBySlug'] ?? $item['data']['findMangaById'] ?? $item['data']['randomMedia'];
? $item['data']['findMangaBySlug']
: $item['data']['findMangaById'];
$characters = []; $characters = [];
$links = []; $links = [];
$staff = []; $staff = [];

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -152,8 +152,6 @@ interface Media {
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int last: Int
): MediaReactionConnection! ): MediaReactionConnection!
"The season this was released in"
season: ReleaseSeasonEnum
"Whether the media is Safe-for-Work" "Whether the media is Safe-for-Work"
sfw: Boolean! sfw: Boolean!
"The URL-friendly identifier of this media" "The URL-friendly identifier of this media"
@ -241,6 +239,8 @@ type Account implements WithTimestamps {
ratingSystem: RatingSystemEnum! ratingSystem: RatingSystemEnum!
"Whether Not Safe For Work content is accessible" "Whether Not Safe For Work content is accessible"
sfwFilter: Boolean sfwFilter: Boolean
"The site-wide permissions this user has access to"
sitePermissions: [SitePermissionEnum!]!
"Time zone of the account" "Time zone of the account"
timeZone: String timeZone: String
"Preferred language for media titles" "Preferred language for media titles"
@ -921,6 +921,8 @@ type Library {
last: Int, last: Int,
mediaType: MediaTypeEnum! mediaType: MediaTypeEnum!
): LibraryEntryConnection! ): LibraryEntryConnection!
"Random anime or manga from this library"
randomMedia(mediaType: MediaTypeEnum!, status: [LibraryEntryStatusEnum!]!): Media
} }
"Information about a specific media entry for a user" "Information about a specific media entry for a user"
@ -1143,6 +1145,13 @@ type LibraryEventEdge {
node: LibraryEvent node: LibraryEvent
} }
"Autogenerated return type of LockPost"
type LockPostPayload {
"Graphql Errors"
errors: [Generic!]
post: Post
}
type Manga implements Media & WithTimestamps { type Manga implements Media & WithTimestamps {
"The recommended minimum age group for this media" "The recommended minimum age group for this media"
ageRating: AgeRatingEnum ageRating: AgeRatingEnum
@ -1245,8 +1254,6 @@ type Manga implements Media & WithTimestamps {
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int last: Int
): MediaReactionConnection! ): MediaReactionConnection!
"The season this was released in"
season: ReleaseSeasonEnum
"Whether the media is Safe-for-Work" "Whether the media is Safe-for-Work"
sfw: Boolean! sfw: Boolean!
"The URL-friendly identifier of this media" "The URL-friendly identifier of this media"
@ -1464,14 +1471,14 @@ type MediaEdge {
"The role a company played in the creation or localization of a media" "The role a company played in the creation or localization of a media"
type MediaProduction implements WithTimestamps { type MediaProduction implements WithTimestamps {
"The production company"
company: Producer!
createdAt: ISO8601DateTime! createdAt: ISO8601DateTime!
id: ID! id: ID!
"The media" "The media"
media: Media! media: Media!
"The producer"
person: Producer!
"The role this company played" "The role this company played"
role: String! role: MediaProductionRoleEnum!
updatedAt: ISO8601DateTime! updatedAt: ISO8601DateTime!
} }
@ -1581,6 +1588,7 @@ type Mutation {
episode: EpisodeMutation episode: EpisodeMutation
libraryEntry: LibraryEntryMutation libraryEntry: LibraryEntryMutation
mapping: MappingMutation mapping: MappingMutation
post: PostMutation
pro: ProMutation! pro: ProMutation!
} }
@ -1684,6 +1692,12 @@ type Post implements WithTimestamps {
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int last: Int
): ProfileConnection! ): ProfileConnection!
"When this post was locked."
lockedAt: ISO8601DateTime
"The user who locked this post."
lockedBy: Profile
"The reason why this post was locked."
lockedReason: LockedReasonEnum
"The media tagged in this post." "The media tagged in this post."
media: Media media: Media
updatedAt: ISO8601DateTime! updatedAt: ISO8601DateTime!
@ -1709,6 +1723,19 @@ type PostEdge {
node: Post node: Post
} }
type PostMutation {
"Lock a Post."
lock(
"Lock a Post."
input: LockInput!
): LockPostPayload
"Unlock a Post."
unlock(
"Unlock a Post."
input: UnlockInput!
): UnlockPostPayload
}
type ProMutation { type ProMutation {
"Set the user's discord tag" "Set the user's discord tag"
setDiscord( setDiscord(
@ -1966,6 +1993,8 @@ type Query {
findPersonById(id: ID!): Person findPersonById(id: ID!): Person
"Find a single Person by Slug" "Find a single Person by Slug"
findPersonBySlug(slug: String!): Person findPersonBySlug(slug: String!): Person
"Find a single Post by ID"
findPostById(id: ID!): Post
"Find a single User by ID" "Find a single User by ID"
findProfileById(id: ID!): Profile findProfileById(id: ID!): Profile
"Find a single User by Slug" "Find a single User by Slug"
@ -2055,6 +2084,8 @@ type Query {
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int last: Int
): ProfileConnection! ): ProfileConnection!
"Random anime or manga"
randomMedia(ageRatings: [AgeRatingEnum!]!, mediaType: MediaTypeEnum!): Media!
"Search for Anime by title using Algolia. The most relevant results will be at the top." "Search for Anime by title using Algolia. The most relevant results will be at the top."
searchAnimeByTitle( searchAnimeByTitle(
"Returns the elements in the list that come after the specified cursor." "Returns the elements in the list that come after the specified cursor."
@ -2079,7 +2110,7 @@ type Query {
last: Int, last: Int,
title: String! title: String!
): MangaConnection! ): MangaConnection!
"Search for any media (Anime, Manga) by title using Algolia. The most relevant results will be at the top." "Search for any media (Anime, Manga) by title using Algolia. If no media_type is supplied, it will search for both. The most relevant results will be at the top."
searchMediaByTitle( searchMediaByTitle(
"Returns the elements in the list that come after the specified cursor." "Returns the elements in the list that come after the specified cursor."
after: String, after: String,
@ -2089,8 +2120,22 @@ type Query {
first: Int, first: Int,
"Returns the last _n_ elements from the list." "Returns the last _n_ elements from the list."
last: Int, last: Int,
"Dynamically choose a specific media_type. If left blank, it will return results for both."
mediaType: MediaTypeEnum,
title: String! title: String!
): MediaConnection! ): MediaConnection!
"Search for User by username using Algolia. The most relevant results will be at the top."
searchProfileByUsername(
"Returns the elements in the list that come after the specified cursor."
after: String,
"Returns the elements in the list that come before the specified cursor."
before: String,
"Returns the first _n_ elements from the list."
first: Int,
"Returns the last _n_ elements from the list."
last: Int,
username: String!
): ProfileConnection
"Get your current session info" "Get your current session info"
session: Session! session: Session!
} }
@ -2172,6 +2217,8 @@ type QuoteLineEdge {
type Session { type Session {
"The account associated with this session" "The account associated with this session"
account: Account account: Account
"Single sign-on token for Nolt"
noltToken: String!
"The profile associated with this session" "The profile associated with this session"
profile: Profile profile: Profile
} }
@ -2302,6 +2349,13 @@ type TitlesList {
localized(locales: [String!]): Map! localized(locales: [String!]): Map!
} }
"Autogenerated return type of UnlockPost"
type UnlockPostPayload {
"Graphql Errors"
errors: [Generic!]
post: Post
}
"Autogenerated return type of Unsubscribe" "Autogenerated return type of Unsubscribe"
type UnsubscribePayload { type UnsubscribePayload {
"Graphql Errors" "Graphql Errors"
@ -2436,6 +2490,12 @@ enum LibraryEventKindEnum {
UPDATED UPDATED
} }
enum LockedReasonEnum {
CLOSED
SPAM
TOO_HEATED
}
enum MangaSubtypeEnum { enum MangaSubtypeEnum {
"Self published work." "Self published work."
DOUJIN DOUJIN
@ -2481,6 +2541,13 @@ enum MappingItemEnum {
PRODUCER PRODUCER
} }
enum MediaProductionRoleEnum {
LICENSOR
PRODUCER
SERIALIZATION
STUDIO
}
"これはアニメやマンガです" "これはアニメやマンガです"
enum MediaTypeEnum { enum MediaTypeEnum {
ANIME ANIME
@ -2542,6 +2609,15 @@ enum ReleaseStatusEnum {
UPCOMING UPCOMING
} }
enum SitePermissionEnum {
"Administrator/staff member of Kitsu"
ADMIN
"Moderator of community behavior"
COMMUNITY_MOD
"Maintainer of the Kitsu media database"
DATABASE_MOD
}
enum TitleLanguagePreferenceEnum { enum TitleLanguagePreferenceEnum {
"Prefer the most commonly-used title for media" "Prefer the most commonly-used title for media"
CANONICAL CANONICAL
@ -2672,6 +2748,11 @@ input LibraryEntryUpdateStatusByMediaInput {
status: LibraryEntryStatusEnum! status: LibraryEntryStatusEnum!
} }
input LockInput {
id: ID!
lockedReason: LockedReasonEnum!
}
input MappingCreateInput { input MappingCreateInput {
externalId: ID! externalId: ID!
externalSite: MappingExternalSiteEnum! externalSite: MappingExternalSiteEnum!
@ -2693,6 +2774,10 @@ input TitlesListInput {
localized: Map localized: Map
} }
input UnlockInput {
id: ID!
}
"A date, expressed as an ISO8601 string" "A date, expressed as an ISO8601 string"
scalar Date scalar Date

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,17 +4,17 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
namespace Aviat\AnimeClient\API; namespace Aviat\AnimeClient;
use Aviat\AnimeClient\API\Enum\{ use Aviat\AnimeClient\API\Enum\{
AnimeWatchingStatus\Kitsu as KAWS, AnimeWatchingStatus\Kitsu as KAWS,
@ -64,28 +64,4 @@ final class Anilist {
MangaReadingStatus::DROPPED => KMRS::DROPPED, MangaReadingStatus::DROPPED => KMRS::DROPPED,
MangaReadingStatus::PLAN_TO_READ => KMRS::PLAN_TO_READ, MangaReadingStatus::PLAN_TO_READ => KMRS::PLAN_TO_READ,
]; ];
public static function getIdToWatchingStatusMap(): array
{
return [
'CURRENT' => AnimeWatchingStatus::WATCHING,
'COMPLETED' => AnimeWatchingStatus::COMPLETED,
'PAUSED' => AnimeWatchingStatus::ON_HOLD,
'DROPPED' => AnimeWatchingStatus::DROPPED,
'PLANNING' => AnimeWatchingStatus::PLAN_TO_WATCH,
'REPEATING' => AnimeWatchingStatus::WATCHING,
];
}
public static function getIdToReadingStatusMap(): array
{
return [
'CURRENT' => MangaReadingStatus::READING,
'COMPLETED' => MangaReadingStatus::COMPLETED,
'PAUSED' => MangaReadingStatus::ON_HOLD,
'DROPPED' => MangaReadingStatus::DROPPED,
'PLANNING' => MangaReadingStatus::PLAN_TO_READ,
'REPEATING' => MangaReadingStatus::READING,
];
}
} }

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -19,7 +19,6 @@ namespace Aviat\AnimeClient;
use Aviat\AnimeClient\Kitsu; use Aviat\AnimeClient\Kitsu;
use Psr\SimpleCache\CacheInterface; use Psr\SimpleCache\CacheInterface;
use Psr\SimpleCache\InvalidArgumentException; use Psr\SimpleCache\InvalidArgumentException;
use function Amp\Promise\wait;
use Amp\Http\Client\Request; use Amp\Http\Client\Request;
use Amp\Http\Client\Response; use Amp\Http\Client\Response;
@ -31,6 +30,8 @@ use Yosymfony\Toml\{Toml, TomlBuilder};
use Throwable; use Throwable;
use function Amp\Promise\wait;
use function Aviat\Ion\_dir;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
//! TOML Functions //! TOML Functions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -38,10 +39,11 @@ use Throwable;
/** /**
* Load configuration options from .toml files * Load configuration options from .toml files
* *
* @codeCoverageIgnore
* @param string $path - Path to load config * @param string $path - Path to load config
* @return array * @return array
*/ */
function loadToml(string $path): array function loadConfig(string $path): array
{ {
$output = []; $output = [];
$files = glob("{$path}/*.toml"); $files = glob("{$path}/*.toml");
@ -75,6 +77,7 @@ function loadToml(string $path): array
/** /**
* Load config from one specific TOML file * Load config from one specific TOML file
* *
* @codeCoverageIgnore
* @param string $filename * @param string $filename
* @return array * @return array
*/ */
@ -83,19 +86,11 @@ function loadTomlFile(string $filename): array
return Toml::parseFile($filename); return Toml::parseFile($filename);
} }
/**
* Serialize config data into a Toml file
*
* @param mixed $data
* @return string
*/
function arrayToToml(iterable $data): string
{
$builder = new TomlBuilder();
function _iterateToml(TomlBuilder $builder, iterable $data, $parentKey = NULL): void function _iterateToml(TomlBuilder $builder, iterable $data, $parentKey = NULL): void
{ {
foreach ($data as $key => $value) foreach ($data as $key => $value)
{ {
// Skip unsupported empty value
if ($value === NULL) if ($value === NULL)
{ {
continue; continue;
@ -104,7 +99,6 @@ function arrayToToml(iterable $data): string
if (is_scalar($value) || isSequentialArray($value)) if (is_scalar($value) || isSequentialArray($value))
{ {
// $builder->addTable('');
$builder->addValue($key, $value); $builder->addValue($key, $value);
continue; continue;
} }
@ -122,6 +116,16 @@ function arrayToToml(iterable $data): string
} }
} }
/**
* Serialize config data into a Toml file
*
* @param mixed $data
* @return string
*/
function arrayToToml(iterable $data): string
{
$builder = new TomlBuilder();
_iterateToml($builder, $data); _iterateToml($builder, $data);
return $builder->getTomlString(); return $builder->getTomlString();
@ -177,9 +181,11 @@ function checkFolderPermissions(ConfigInterface $config): array
$errors = []; $errors = [];
$publicDir = $config->get('asset_dir'); $publicDir = $config->get('asset_dir');
$APP_DIR = _dir(dirname(__DIR__, 2), '/app');
$pathMap = [ $pathMap = [
'app/config' => realpath(__DIR__ . '/../../app/config'), 'app/config' => "{$APP_DIR}/config",
'app/logs' => realpath(__DIR__ . '/../../app/logs'), 'app/logs' => "{$APP_DIR}/logs",
'public/images/avatars' => "{$publicDir}/images/avatars", 'public/images/avatars' => "{$publicDir}/images/avatars",
'public/images/anime' => "{$publicDir}/images/anime", 'public/images/anime' => "{$publicDir}/images/anime",
'public/images/characters' => "{$publicDir}/images/characters", 'public/images/characters' => "{$publicDir}/images/characters",
@ -231,7 +237,7 @@ function getApiClient (): HttpClient
* @return Response * @return Response
* @throws Throwable * @throws Throwable
*/ */
function getResponse ($request): Response function getResponse (Request|string $request): Response
{ {
$client = getApiClient(); $client = getApiClient();
@ -250,7 +256,7 @@ function getResponse ($request): Response
* @param bool $webp * @param bool $webp
* @return string * @return string
*/ */
function getLocalImg ($kitsuUrl, $webp = TRUE): string function getLocalImg (string $kitsuUrl, $webp = TRUE): string
{ {
if (empty($kitsuUrl) || ( ! is_string($kitsuUrl))) if (empty($kitsuUrl) || ( ! is_string($kitsuUrl)))
{ {
@ -282,11 +288,11 @@ function getLocalImg ($kitsuUrl, $webp = TRUE): string
* Create a transparent placeholder image * Create a transparent placeholder image
* *
* @param string $path * @param string $path
* @param int $width * @param int|null $width
* @param int $height * @param int|null $height
* @param string $text * @param string $text
*/ */
function createPlaceholderImage ($path, ?int $width, ?int $height, $text = 'Image Unavailable'): void function createPlaceholderImage (string $path, ?int $width, ?int $height, $text = 'Image Unavailable'): void
{ {
$width = $width ?? 200; $width = $width ?? 200;
$height = $height ?? 200; $height = $height ?? 200;
@ -339,7 +345,7 @@ function createPlaceholderImage ($path, ?int $width, ?int $height, $text = 'Imag
*/ */
function colNotEmpty(array $search, string $key): bool function colNotEmpty(array $search, string $key): bool
{ {
$items = array_filter(array_column($search, $key), fn ($x) => ( ! empty($x))); $items = array_filter(array_column($search, $key), static fn ($x) => ( ! empty($x)));
return count($items) > 0; return count($items) > 0;
} }
@ -358,9 +364,9 @@ function clearCache(CacheInterface $cache): bool
Kitsu::AUTH_TOKEN_CACHE_KEY, Kitsu::AUTH_TOKEN_CACHE_KEY,
Kitsu::AUTH_TOKEN_EXP_CACHE_KEY, Kitsu::AUTH_TOKEN_EXP_CACHE_KEY,
Kitsu::AUTH_TOKEN_REFRESH_CACHE_KEY, Kitsu::AUTH_TOKEN_REFRESH_CACHE_KEY,
], NULL); ]);
$userData = array_filter((array)$userData, fn ($value) => $value !== NULL); $userData = array_filter((array)$userData, static fn ($value) => $value !== NULL);
$cleared = $cache->clear(); $cleared = $cache->clear();
$saved = ( ! empty($userData)) $saved = ( ! empty($userData))
@ -373,6 +379,7 @@ function clearCache(CacheInterface $cache): bool
/** /**
* Render a PHP code template as a string * Render a PHP code template as a string
* *
* @codeCoverageIgnore
* @param string $path * @param string $path
* @param array $data * @param array $data
* @return string * @return string

View File

@ -4,20 +4,24 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
namespace Aviat\AnimeClient\Command; namespace Aviat\AnimeClient\Command;
use Monolog\Formatter\JsonFormatter; use Monolog\Formatter\JsonFormatter;
use function Aviat\AnimeClient\loadToml;
use function Aviat\Ion\_dir;
use const Aviat\AnimeClient\SRC_DIR;
use function Aviat\AnimeClient\loadConfig;
use function Aviat\AnimeClient\loadTomlFile; use function Aviat\AnimeClient\loadTomlFile;
use Aura\Router\RouterContainer; use Aura\Router\RouterContainer;
@ -108,14 +112,14 @@ abstract class BaseCommand extends Command {
*/ */
public function setupContainer(): ContainerInterface public function setupContainer(): ContainerInterface
{ {
$APP_DIR = realpath(__DIR__ . '/../../../app'); $APP_DIR = _dir(dirname(SRC_DIR), 'app');
$APPCONF_DIR = realpath("{$APP_DIR}/appConf/"); $APPCONF_DIR = realpath(_dir($APP_DIR, 'appConf'));
$CONF_DIR = realpath("{$APP_DIR}/config/"); $CONF_DIR = realpath(_dir($APP_DIR, 'config'));
$baseConfig = require $APPCONF_DIR . '/base_config.php'; $baseConfig = require _dir($APPCONF_DIR, 'base_config.php');
$config = loadToml($CONF_DIR); $config = loadConfig($CONF_DIR);
$overrideFile = $CONF_DIR . '/admin-override.toml'; $overrideFile = _dir($CONF_DIR, 'admin-override.toml');
$overrideConfig = file_exists($overrideFile) $overrideConfig = file_exists($overrideFile)
? loadTomlFile($overrideFile) ? loadTomlFile($overrideFile)
: []; : [];
@ -168,7 +172,7 @@ abstract class BaseCommand extends Command {
// Create Request/Response Objects // Create Request/Response Objects
$container->set('request', fn () => ServerRequestFactory::fromGlobals( $container->set('request', fn () => ServerRequestFactory::fromGlobals(
$_SERVER, $GLOBALS['_SERVER'],
$_GET, $_GET,
$_POST, $_POST,
$_COOKIE, $_COOKIE,

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -29,7 +29,7 @@ class ClearThumbnails extends BaseCommand {
private function clearThumbs(): void private function clearThumbs(): void
{ {
$imgDir = realpath(__DIR__ . '/../../public/images'); $imgDir = dirname(__DIR__, 3) . '/public/images';
$paths = [ $paths = [
'anime/*.jpg', 'anime/*.jpg',

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -25,7 +25,8 @@ use Aviat\AnimeClient\API\{
use Aviat\AnimeClient\API; use Aviat\AnimeClient\API;
use Aviat\AnimeClient\API\Anilist; use Aviat\AnimeClient\API\Anilist;
use Aviat\AnimeClient\API\Mapping\{AnimeWatchingStatus, MangaReadingStatus}; use Aviat\AnimeClient\API\Mapping\{AnimeWatchingStatus, MangaReadingStatus};
use Aviat\AnimeClient\Enum\{ListType, SyncAction}; use Aviat\AnimeClient\Enum;
use Aviat\AnimeClient\Enum\{MediaType, SyncAction};
use Aviat\AnimeClient\Types\FormItem; use Aviat\AnimeClient\Types\FormItem;
use Aviat\Ion\Di\Exception\ContainerException; use Aviat\Ion\Di\Exception\ContainerException;
use Aviat\Ion\Di\Exception\NotFoundException; use Aviat\Ion\Di\Exception\NotFoundException;
@ -73,7 +74,7 @@ final class SyncLists extends BaseCommand {
{ {
$this->init(); $this->init();
foreach ([ListType::ANIME, ListType::MANGA] as $type) foreach ([MediaType::ANIME, MediaType::MANGA] as $type)
{ {
// Main Sync flow // Main Sync flow
$this->fetchCount($type); $this->fetchCount($type);
@ -100,7 +101,7 @@ final class SyncLists extends BaseCommand {
$this->setCache($this->container->get('cache')); $this->setCache($this->container->get('cache'));
$config = $this->container->get('config'); $config = $this->container->get('config');
$anilistEnabled = $config->get([API::ANILIST, 'enabled']); $anilistEnabled = $config->get([Enum\API::ANILIST, 'enabled']);
// We can't sync kitsu against itself! // We can't sync kitsu against itself!
if ( ! $anilistEnabled) if ( ! $anilistEnabled)
@ -165,8 +166,8 @@ final class SyncLists extends BaseCommand {
$this->clearLine(); $this->clearLine();
return [ return [
API::ANILIST => $anilist, Enum\API::ANILIST => $anilist,
API::KITSU => $kitsu, Enum\API::KITSU => $kitsu,
]; ];
} }
@ -182,17 +183,17 @@ final class SyncLists extends BaseCommand {
$this->echo('Normalizing List Data'); $this->echo('Normalizing List Data');
$progress = new Widgets\ProgressBar($this->getConsole(), 2, 50, FALSE); $progress = new Widgets\ProgressBar($this->getConsole(), 2, 50, FALSE);
$kitsu = $this->transformKitsu($type, $data[API::KITSU]); $kitsu = $this->transformKitsu($type, $data[Enum\API::KITSU]);
$progress->incr(); $progress->incr();
$anilist = $this->transformAnilist($type, $data[API::ANILIST]); $anilist = $this->transformAnilist($type, $data[Enum\API::ANILIST]);
$progress->incr(); $progress->incr();
$this->clearLine(); $this->clearLine();
return [ return [
API::ANILIST => $anilist, Enum\API::ANILIST => $anilist,
API::KITSU => $kitsu, Enum\API::KITSU => $kitsu,
]; ];
} }
@ -207,7 +208,7 @@ final class SyncLists extends BaseCommand {
{ {
$this->echo('Comparing List Items'); $this->echo('Comparing List Items');
return $this->compareLists($type, $data[API::ANILIST], $data[API::KITSU]); return $this->compareLists($type, $data[Enum\API::ANILIST], $data[Enum\API::KITSU]);
} }
/** /**
@ -280,8 +281,8 @@ final class SyncLists extends BaseCommand {
private function fetchAnilist(string $type): array private function fetchAnilist(string $type): array
{ {
static $list = [ static $list = [
ListType::ANIME => NULL, MediaType::ANIME => NULL,
ListType::MANGA => NULL, MediaType::MANGA => NULL,
]; ];
// This uses a static so I don't have to fetch this list twice for a count // This uses a static so I don't have to fetch this list twice for a count
@ -435,12 +436,12 @@ final class SyncLists extends BaseCommand {
continue; continue;
} }
if (in_array(API::KITSU, $item['updateType'], TRUE)) if (in_array(Enum\API::KITSU, $item['updateType'], TRUE))
{ {
$kitsuUpdateItems[] = $item['data']; $kitsuUpdateItems[] = $item['data'];
} }
if (in_array(API::ANILIST, $item['updateType'], TRUE)) if (in_array(Enum\API::ANILIST, $item['updateType'], TRUE))
{ {
$anilistUpdateItems[] = $item['data']; $anilistUpdateItems[] = $item['data'];
} }
@ -448,7 +449,7 @@ final class SyncLists extends BaseCommand {
continue; continue;
} }
$statusMap = ($type === ListType::ANIME) ? AnimeWatchingStatus::class : MangaReadingStatus::class; $statusMap = ($type === MediaType::ANIME) ? AnimeWatchingStatus::class : MangaReadingStatus::class;
// Looks like this item only exists on Kitsu // Looks like this item only exists on Kitsu
$kItem = $kitsuItem['data']; $kItem = $kitsuItem['data'];
@ -528,7 +529,7 @@ final class SyncLists extends BaseCommand {
if ($kitsuItem['data']['status'] === 'completed' && $kitsuItem['data']['reconsuming'] === TRUE) if ($kitsuItem['data']['status'] === 'completed' && $kitsuItem['data']['reconsuming'] === TRUE)
{ {
$update['data']['reconsuming'] = FALSE; $update['data']['reconsuming'] = FALSE;
$return['updateType'][] = API::KITSU; $return['updateType'][] = Enum\API::KITSU;
} }
// If status is the same, and progress count is different, use greater progress // If status is the same, and progress count is different, use greater progress
@ -537,12 +538,12 @@ final class SyncLists extends BaseCommand {
if ($diff['progress'] === self::KITSU_GREATER) if ($diff['progress'] === self::KITSU_GREATER)
{ {
$update['data']['progress'] = $kitsuItem['data']['progress']; $update['data']['progress'] = $kitsuItem['data']['progress'];
$return['updateType'][] = API::ANILIST; $return['updateType'][] = Enum\API::ANILIST;
} }
else if($diff['progress'] === self::ANILIST_GREATER) else if($diff['progress'] === self::ANILIST_GREATER)
{ {
$update['data']['progress'] = $anilistItem['data']['progress']; $update['data']['progress'] = $anilistItem['data']['progress'];
$return['updateType'][] = API::KITSU; $return['updateType'][] = Enum\API::KITSU;
} }
} }
@ -552,12 +553,12 @@ final class SyncLists extends BaseCommand {
if ($dateDiff === self::KITSU_GREATER) if ($dateDiff === self::KITSU_GREATER)
{ {
$update['data']['status'] = $kitsuItem['data']['status']; $update['data']['status'] = $kitsuItem['data']['status'];
$return['updateType'][] = API::ANILIST; $return['updateType'][] = Enum\API::ANILIST;
} }
else if ($dateDiff === self::ANILIST_GREATER) else if ($dateDiff === self::ANILIST_GREATER)
{ {
$update['data']['status'] = $anilistItem['data']['status']; $update['data']['status'] = $anilistItem['data']['status'];
$return['updateType'][] = API::KITSU; $return['updateType'][] = Enum\API::KITSU;
} }
} }
@ -574,7 +575,7 @@ final class SyncLists extends BaseCommand {
$update['data']['progress'] = $kitsuItem['data']['progress']; $update['data']['progress'] = $kitsuItem['data']['progress'];
} }
$return['updateType'][] = API::ANILIST; $return['updateType'][] = Enum\API::ANILIST;
} }
else if($dateDiff === self::ANILIST_GREATER) else if($dateDiff === self::ANILIST_GREATER)
{ {
@ -585,7 +586,7 @@ final class SyncLists extends BaseCommand {
$update['data']['progress'] = $kitsuItem['data']['progress']; $update['data']['progress'] = $kitsuItem['data']['progress'];
} }
$return['updateType'][] = API::KITSU; $return['updateType'][] = Enum\API::KITSU;
} }
} }
@ -599,12 +600,12 @@ final class SyncLists extends BaseCommand {
) )
{ {
$update['data']['ratingTwenty'] = $kitsuItem['data']['ratingTwenty']; $update['data']['ratingTwenty'] = $kitsuItem['data']['ratingTwenty'];
$return['updateType'][] = API::ANILIST; $return['updateType'][] = Enum\API::ANILIST;
} }
else if($dateDiff === self::ANILIST_GREATER && $anilistItem['data']['rating'] !== 0) else if($dateDiff === self::ANILIST_GREATER && $anilistItem['data']['rating'] !== 0)
{ {
$update['data']['ratingTwenty'] = $anilistItem['data']['rating'] * 2; $update['data']['ratingTwenty'] = $anilistItem['data']['rating'] * 2;
$return['updateType'][] = API::KITSU; $return['updateType'][] = Enum\API::KITSU;
} }
} }
@ -614,12 +615,12 @@ final class SyncLists extends BaseCommand {
if ( ! empty($kitsuItem['data']['notes'])) if ( ! empty($kitsuItem['data']['notes']))
{ {
$update['data']['notes'] = $kitsuItem['data']['notes']; $update['data']['notes'] = $kitsuItem['data']['notes'];
$return['updateType'][] = API::ANILIST; $return['updateType'][] = Enum\API::ANILIST;
} }
else else
{ {
$update['data']['notes'] = $anilistItem['data']['notes']; $update['data']['notes'] = $anilistItem['data']['notes'];
$return['updateType'][] = API::KITSU; $return['updateType'][] = Enum\API::KITSU;
} }
} }
@ -629,12 +630,12 @@ final class SyncLists extends BaseCommand {
if ($diff['reconsumeCount'] === self::KITSU_GREATER) if ($diff['reconsumeCount'] === self::KITSU_GREATER)
{ {
$update['data']['reconsumeCount'] = $kitsuItem['data']['reconsumeCount']; $update['data']['reconsumeCount'] = $kitsuItem['data']['reconsumeCount'];
$return['updateType'][] = API::ANILIST; $return['updateType'][] = Enum\API::ANILIST;
} }
else if ($diff['reconsumeCount'] === self::ANILIST_GREATER) else if ($diff['reconsumeCount'] === self::ANILIST_GREATER)
{ {
$update['data']['reconsumeCount'] = $anilistItem['data']['reconsumeCount']; $update['data']['reconsumeCount'] = $anilistItem['data']['reconsumeCount'];
$return['updateType'][] = API::KITSU; $return['updateType'][] = Enum\API::KITSU;
} }
} }
@ -645,8 +646,8 @@ final class SyncLists extends BaseCommand {
} }
$return['meta'] = [ $return['meta'] = [
API::KITSU => $kitsuItem['data'], Enum\API::KITSU => $kitsuItem['data'],
API::ANILIST => $anilistItem['data'], Enum\API::ANILIST => $anilistItem['data'],
'dateDiff' => $dateDiff, 'dateDiff' => $dateDiff,
'diff' => $diff, 'diff' => $diff,
]; ];
@ -656,7 +657,7 @@ final class SyncLists extends BaseCommand {
// Fill in missing data values for update // Fill in missing data values for update
// so I don't have to create a really complex graphql query // so I don't have to create a really complex graphql query
// to handle each combination of fields // to handle each combination of fields
if ($return['updateType'][0] === API::ANILIST) if ($return['updateType'][0] === Enum\API::ANILIST)
{ {
// Anilist GraphQL expects a rating from 1-100 // Anilist GraphQL expects a rating from 1-100
$prevData = [ $prevData = [
@ -673,7 +674,7 @@ final class SyncLists extends BaseCommand {
$return['data']['data'] = array_merge($prevData, $return['data']['data']); $return['data']['data'] = array_merge($prevData, $return['data']['data']);
} }
else if ($return['updateType'][0] === API::KITSU) else if ($return['updateType'][0] === Enum\API::KITSU)
{ {
$prevData = [ $prevData = [
'notes' => $anilistItem['data']['notes'], 'notes' => $anilistItem['data']['notes'],
@ -707,7 +708,7 @@ final class SyncLists extends BaseCommand {
* @param string $type * @param string $type
* @throws Throwable * @throws Throwable
*/ */
private function updateKitsuListItems(array $itemsToUpdate, string $action = SyncAction::UPDATE, string $type = ListType::ANIME): void private function updateKitsuListItems(array $itemsToUpdate, string $action = SyncAction::UPDATE, string $type = MediaType::ANIME): void
{ {
$requester = new ParallelAPIRequest(); $requester = new ParallelAPIRequest();
foreach($itemsToUpdate as $item) foreach($itemsToUpdate as $item)
@ -776,7 +777,7 @@ final class SyncLists extends BaseCommand {
* @param string $type * @param string $type
* @throws Throwable * @throws Throwable
*/ */
private function updateAnilistListItems(array $itemsToUpdate, string $action = SyncAction::UPDATE, string $type = ListType::ANIME): void private function updateAnilistListItems(array $itemsToUpdate, string $action = SyncAction::UPDATE, string $type = MediaType::ANIME): void
{ {
$requester = new ParallelAPIRequest(); $requester = new ParallelAPIRequest();

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -69,11 +69,11 @@ final class UpdateThumbnails extends ClearThumbnails {
public function getImageList(): array public function getImageList(): array
{ {
$animeIds = array_map( $animeIds = array_map(
fn ($item) => $item['media']['id'], static fn ($item) => $item['media']['id'],
$this->kitsuModel->getThumbList('ANIME') $this->kitsuModel->getThumbList('ANIME')
); );
$mangaIds = array_map( $mangaIds = array_map(
fn ($item) => $item['media']['id'], static fn ($item) => $item['media']['id'],
$this->kitsuModel->getThumbList('MANGA') $this->kitsuModel->getThumbList('MANGA')
); );

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -26,6 +26,7 @@ final class VerticalTabs {
* also used to generate id attributes * also used to generate id attributes
* @param array $tabData The data used to create the tab content, indexed by the tab label * @param array $tabData The data used to create the tab content, indexed by the tab label
* @param callable $cb The function to generate the tab content * @param callable $cb The function to generate the tab content
* @param string $className
* @return string * @return string
*/ */
public function __invoke( public function __invoke(

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -46,49 +46,41 @@ class Controller {
/** /**
* The authentication object * The authentication object
* @var Auth $auth ;
*/ */
protected Auth $auth; protected Auth $auth;
/** /**
* Cache manager * Cache manager
* @var CacheInterface
*/ */
protected CacheInterface $cache; protected CacheInterface $cache;
/** /**
* The global configuration object * The global configuration object
* @var ConfigInterface $config
*/ */
public ConfigInterface $config; public ConfigInterface $config;
/** /**
* Request object * Request object
* @var ServerRequestInterface $request
*/ */
protected ServerRequestInterface $request; protected ServerRequestInterface $request;
/** /**
* Url generation class * Url generation class
* @var UrlGenerator
*/ */
protected UrlGenerator $urlGenerator; protected UrlGenerator $urlGenerator;
/** /**
* Aura url generator * Aura url generator
* @var Generator
*/ */
protected Generator $url; protected Generator $url;
/** /**
* Session segment * Session segment
* @var Segment
*/ */
protected Segment $session; protected Segment $session;
/** /**
* Common data to be sent to views * Common data to be sent to views
* @var array
*/ */
protected array $baseData = []; protected array $baseData = [];

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -66,17 +66,17 @@ final class Anime extends BaseController {
/** /**
* Show a portion, or all of the anime list * Show a portion, or all of the anime list
* *
* @param string|int $type - The section of the list * @param string|int $status - The section of the list
* @param string $view - List or cover view * @param string|null $view - List or cover view
* @throws ContainerException * @throws ContainerException
* @throws NotFoundException * @throws NotFoundException
* @throws InvalidArgumentException * @throws InvalidArgumentException
* @throws Throwable * @throws Throwable
* @return void * @return void
*/ */
public function index($type = KitsuWatchingStatus::WATCHING, string $view = NULL): void public function index($status = KitsuWatchingStatus::WATCHING, ?string $view = NULL): void
{ {
if ( ! in_array($type, [ if ( ! in_array($status, [
'all', 'all',
'watching', 'watching',
'plan_to_watch', 'plan_to_watch',
@ -88,10 +88,10 @@ final class Anime extends BaseController {
$this->errorPage(404, 'Not Found', 'Page not found'); $this->errorPage(404, 'Not Found', 'Page not found');
} }
$title = array_key_exists($type, AnimeWatchingStatus::ROUTE_TO_TITLE) $title = array_key_exists($status, AnimeWatchingStatus::ROUTE_TO_TITLE)
? $this->formatTitle( ? $this->formatTitle(
$this->config->get('whose_list') . "'s Anime List", $this->config->get('whose_list') . "'s Anime List",
AnimeWatchingStatus::ROUTE_TO_TITLE[$type] AnimeWatchingStatus::ROUTE_TO_TITLE[$status]
) )
: ''; : '';
@ -100,8 +100,8 @@ final class Anime extends BaseController {
'list' => 'list' 'list' => 'list'
]; ];
$data = ($type !== 'all') $data = ($status !== 'all')
? $this->model->getList(AnimeWatchingStatus::ROUTE_TO_KITSU[$type]) ? $this->model->getList(AnimeWatchingStatus::ROUTE_TO_KITSU[$status])
: $this->model->getAllLists(); : $this->model->getAllLists();
$this->outputHTML('anime/' . $viewMap[$view], [ $this->outputHTML('anime/' . $viewMap[$view], [
@ -138,8 +138,6 @@ final class Anime extends BaseController {
/** /**
* Add an anime to the list * Add an anime to the list
* *
* @throws ContainerException
* @throws NotFoundException
* @throws Throwable * @throws Throwable
* @return void * @return void
*/ */
@ -215,8 +213,6 @@ final class Anime extends BaseController {
/** /**
* Update an anime item via a form submission * Update an anime item via a form submission
* *
* @throws ContainerException
* @throws NotFoundException
* @throws Throwable * @throws Throwable
* @return void * @return void
*/ */
@ -305,17 +301,17 @@ final class Anime extends BaseController {
/** /**
* View details of an anime * View details of an anime
* *
* @param string $animeId * @param string $id
* @throws ContainerException * @throws ContainerException
* @throws NotFoundException * @throws NotFoundException
* @throws InvalidArgumentException * @throws InvalidArgumentException
* @return void * @return void
*/ */
public function details(string $animeId): void public function details(string $id): void
{ {
try try
{ {
$data = $this->model->getAnime($animeId); $data = $this->model->getAnime($id);
if ($data->isEmpty()) if ($data->isEmpty())
{ {
@ -338,7 +334,45 @@ final class Anime extends BaseController {
'data' => $data, 'data' => $data,
]); ]);
} }
catch (TypeError $e) catch (TypeError)
{
$this->notFound(
$this->config->get('whose_list') .
"'s Anime List &middot; Anime &middot; " .
'Anime not found',
'Anime Not Found'
);
}
}
public function random(): void
{
try
{
$data = $this->model->getRandomAnime();
if ($data->isEmpty())
{
$this->notFound(
$this->config->get('whose_list') .
"'s Anime List &middot; Anime &middot; " .
'Anime not found',
'Anime Not Found'
);
return;
}
$this->outputHTML('anime/details', [
'title' => $this->formatTitle(
$this->config->get('whose_list') . "'s Anime List",
'Anime',
$data->title
),
'data' => $data,
]);
}
catch (TypeError)
{ {
$this->notFound( $this->notFound(
$this->config->get('whose_list') . $this->config->get('whose_list') .

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -88,13 +88,13 @@ final class AnimeCollection extends BaseController {
/** /**
* Show the anime collection page * Show the anime collection page
* *
* @param string $view * @param string|null $view
* @throws ContainerException * @throws ContainerException
* @throws NotFoundException * @throws NotFoundException
* @throws InvalidArgumentException * @throws InvalidArgumentException
* @return void * @return void
*/ */
public function view($view): void public function view(?string $view = ''): void
{ {
$viewMap = [ $viewMap = [
'' => 'cover', '' => 'cover',

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -303,19 +303,49 @@ final class Manga extends Controller {
/** /**
* View details of an manga * View details of an manga
* *
* @param string $manga_id * @param string $id
* @throws ContainerException * @throws ContainerException
* @throws NotFoundException * @throws NotFoundException
* @throws InvalidArgumentException * @throws InvalidArgumentException
* @throws Throwable * @throws Throwable
* @return void * @return void
*/ */
public function details($manga_id): void public function details(string $id): void
{ {
$data = $this->model->getManga($manga_id); $data = $this->model->getManga($id);
$staff = []; if ($data->isEmpty())
$characters = []; {
$this->notFound(
$this->config->get('whose_list') .
"'s Manga List &middot; Manga &middot; " .
'Manga not found',
'Manga Not Found'
);
return;
}
$this->outputHTML('manga/details', [
'title' => $this->formatTitle(
$this->config->get('whose_list') . "'s Manga List",
'Manga',
$data['title']
),
'data' => $data,
]);
}
/**
* View details of a random manga
*
* @throws ContainerException
* @throws NotFoundException
* @throws InvalidArgumentException
* @throws Throwable
* @return void
*/
public function random(): void
{
$data = $this->model->getRandomManga();
if ($data->isEmpty()) if ($data->isEmpty())
{ {
$this->notFound( $this->notFound(
@ -333,9 +363,7 @@ final class Manga extends Controller {
'Manga', 'Manga',
$data['title'] $data['title']
), ),
'characters' => $characters,
'data' => $data, 'data' => $data,
'staff' => $staff,
]); ]);
} }
} }

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -268,7 +268,7 @@ final class Dispatcher extends RoutingBase {
* @param array $params * @param array $params
* @return void * @return void
*/ */
protected function call($controllerName, $method, array $params): void protected function call(string $controllerName, string $method, array $params): void
{ {
$logger = $this->container->getLogger('default'); $logger = $this->container->getLogger('default');
@ -282,7 +282,7 @@ final class Dispatcher extends RoutingBase {
$logger->debug('Dispatcher - controller arguments', $params); $logger->debug('Dispatcher - controller arguments', $params);
} }
call_user_func_array([$controller, $method], $params); call_user_func_array([$controller, $method], array_values($params));
} }
catch (FailedResponseException $e) catch (FailedResponseException $e)
{ {
@ -388,21 +388,21 @@ final class Dispatcher extends RoutingBase {
$route['controller'] = $controllerClass; $route['controller'] = $controllerClass;
// Select the appropriate router method based on the http verb // Select the appropriate router method based on the http verb
$add = array_key_exists('verb', $route) $verb = array_key_exists('verb', $route)
? strtolower($route['verb']) ? strtolower($route['verb'])
: 'get'; : 'get';
// Add the route to the router object // Add the route to the router object
if ( ! array_key_exists('tokens', $route)) if ( ! array_key_exists('tokens', $route))
{ {
$routes[] = $this->router->$add($name, $path)->defaults($route); $routes[] = $this->router->$verb($name, $path)->defaults($route);
continue; continue;
} }
$tokens = $route['tokens']; $tokens = $route['tokens'];
unset($route['tokens']); unset($route['tokens']);
$routes[] = $this->router->$add($name, $path) $routes[] = $this->router->$verb($name, $path)
->defaults($route) ->defaults($route)
->tokens($tokens); ->tokens($tokens);
} }

View File

@ -4,19 +4,21 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
namespace Aviat\AnimeClient; namespace Aviat\AnimeClient\Enum;
class API { use Aviat\Ion\Enum;
final class API extends Enum {
public const ANILIST = 'anilist'; public const ANILIST = 'anilist';
public const KITSU = 'kitsu'; public const KITSU = 'kitsu';
} }

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -19,9 +19,9 @@ namespace Aviat\AnimeClient\Enum;
use Aviat\Ion\Enum as BaseEnum; use Aviat\Ion\Enum as BaseEnum;
/** /**
* Types of lists * Types of media
*/ */
final class ListType extends BaseEnum { final class MediaType extends BaseEnum {
public const ANIME = 'anime'; public const ANIME = 'anime';
public const DRAMA = 'drama'; public const DRAMA = 'drama';
public const MANGA = 'manga'; public const MANGA = 'manga';

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -52,15 +52,7 @@ final class FormGenerator {
*/ */
public static function new(ContainerInterface $container): self public static function new(ContainerInterface $container): self
{ {
try return new self($container);
{
return new static($container);
}
catch (\Throwable $e)
{
dump($e);
die();
}
} }
/** /**
@ -74,7 +66,7 @@ final class FormGenerator {
{ {
$type = $form['type']; $type = $form['type'];
$display = $form['display'] ?? TRUE; $display = $form['display'] ?? TRUE;
$value = $form['value'] ?? ''; $value = $form['value'] ?? $form['default'] ?? '';
if ($display === FALSE) if ($display === FALSE)
{ {
@ -101,6 +93,7 @@ final class FormGenerator {
'1' => 'Yes', '1' => 'Yes',
'0' => 'No', '0' => 'No',
]; ];
$params['strict'] = true;
unset($params['attribs']['id']); unset($params['attribs']['id']);
break; break;

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -49,7 +49,8 @@ final class Picture {
]; ];
/** /**
* Create the html for an html picture element * Create the html for an html picture element.
* Uses .webp images with fallback
* *
* @param string $uri * @param string $uri
* @param string $fallbackExt * @param string $fallbackExt

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -187,14 +187,14 @@ final class Kitsu {
$host = parse_url($url, \PHP_URL_HOST); $host = parse_url($url, \PHP_URL_HOST);
$links[] = [ $links[] = [
'meta' => static::getServiceMetaData($host), 'meta' => self::getServiceMetaData($host),
'link' => $streamingLink['url'], 'link' => $streamingLink['url'],
'subs' => $streamingLink['subs'], 'subs' => $streamingLink['subs'],
'dubs' => $streamingLink['dubs'] 'dubs' => $streamingLink['dubs']
]; ];
} }
usort($links, fn ($a, $b) => $a['meta']['name'] <=> $b['meta']['name']); usort($links, static fn ($a, $b) => $a['meta']['name'] <=> $b['meta']['name']);
return $links; return $links;
} }
@ -282,7 +282,7 @@ final class Kitsu {
*/ */
protected static function getServiceMetaData(string $hostname = NULL): array protected static function getServiceMetaData(string $hostname = NULL): array
{ {
$hostname = str_replace('www.', '', $hostname); $hostname = str_replace('www.', '', $hostname ?? '');
$serviceMap = [ $serviceMap = [
'animelab.com' => [ 'animelab.com' => [
@ -416,7 +416,7 @@ final class Kitsu {
* @param array $existingTitles * @param array $existingTitles
* @return bool * @return bool
*/ */
private static function titleIsUnique(string $title = NULL, array $existingTitles = []): bool private static function titleIsUnique(string $title = '', array $existingTitles = []): bool
{ {
if (empty($title)) if (empty($title))
{ {

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -49,15 +49,7 @@ final class MenuGenerator extends UrlGenerator {
*/ */
public static function new(ContainerInterface $container): self public static function new(ContainerInterface $container): self
{ {
try return new self($container);
{
return new static($container);
}
catch (\Throwable $e)
{
dump($e);
die();
}
} }
/** /**
@ -67,7 +59,7 @@ final class MenuGenerator extends UrlGenerator {
* @throws ConfigException * @throws ConfigException
* @return string * @return string
*/ */
public function generate($menu) : string public function generate(string $menu) : string
{ {
$menus = $this->config->get('menus'); $menus = $this->config->get('menus');
$parsedConfig = $this->parseConfig($menus); $parsedConfig = $this->parseConfig($menus);

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -83,6 +83,16 @@ class Anime extends API {
return $this->kitsuModel->getAnime($slug); return $this->kitsuModel->getAnime($slug);
} }
/**
* Get information about a random anime
*
* @return AnimeType
*/
public function getRandomAnime(): AnimeType
{
return $this->kitsuModel->getRandomAnime();
}
/** /**
* Get anime by its kitsu id * Get anime by its kitsu id
* *

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */
@ -134,6 +134,7 @@ final class AnimeCollection extends Collection {
} }
// Organize the media types into groups // Organize the media types into groups
// @TODO: make this more database-driven, rather than hardcoded
return [ return [
'Common' => [ 'Common' => [
2 => $flatList[2], // Blu-ray 2 => $flatList[2], // Blu-ray

View File

@ -4,13 +4,13 @@
* *
* An API client for Kitsu to manage anime and manga watch lists * An API client for Kitsu to manage anime and manga watch lists
* *
* PHP version 7.4 * PHP version 7.4+
* *
* @package HummingbirdAnimeClient * @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net> * @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren * @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License * @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.1 * @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/ */

Some files were not shown because too many files have changed in this diff Show More