Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
634335187e
@ -4,7 +4,6 @@ install:
|
|||||||
- composer install --ignore-platform-reqs
|
- composer install --ignore-platform-reqs
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 7
|
|
||||||
- 7.1
|
- 7.1
|
||||||
- 7.2
|
- 7.2
|
||||||
- hhvm
|
- hhvm
|
||||||
|
@ -33,7 +33,7 @@ Update your anime/manga list on Kitsu.io and MyAnimeList.net
|
|||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
* PHP 7.0+
|
* PHP 7.1+
|
||||||
* PDO SQLite or PDO PostgreSQL (For collection tab)
|
* PDO SQLite or PDO PostgreSQL (For collection tab)
|
||||||
* GD
|
* GD
|
||||||
* Redis or Memcached for caching
|
* Redis or Memcached for caching
|
||||||
|
@ -26,7 +26,7 @@ $ROOT_DIR = realpath("{$APP_DIR}/../");
|
|||||||
|
|
||||||
$tomlConfig = loadToml(__DIR__);
|
$tomlConfig = loadToml(__DIR__);
|
||||||
|
|
||||||
$base_config = array_merge($tomlConfig, [
|
return array_merge($tomlConfig, [
|
||||||
'asset_dir' => "{$ROOT_DIR}/public",
|
'asset_dir' => "{$ROOT_DIR}/public",
|
||||||
|
|
||||||
// Template file path
|
// Template file path
|
||||||
|
@ -16,17 +16,14 @@
|
|||||||
|
|
||||||
|
|
||||||
use const Aviat\AnimeClient\{
|
use const Aviat\AnimeClient\{
|
||||||
DEFAULT_CONTROLLER_NAMESPACE,
|
|
||||||
DEFAULT_CONTROLLER_METHOD,
|
DEFAULT_CONTROLLER_METHOD,
|
||||||
DEFAULT_CONTROLLER
|
DEFAULT_CONTROLLER
|
||||||
};
|
};
|
||||||
|
|
||||||
use Aviat\AnimeClient\AnimeClient;
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Routing Config
|
// Routing Config
|
||||||
//
|
//
|
||||||
// Maps paths to controlers and methods
|
// Maps paths to controllers and methods
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
return [
|
return [
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -36,7 +36,7 @@ use Zend\Diactoros\{Response, ServerRequestFactory};
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Setup DI container
|
// Setup DI container
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
return function(array $configArray = []) {
|
return function (array $configArray = []) {
|
||||||
$container = new Container();
|
$container = new Container();
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@ -49,7 +49,7 @@ return function(array $configArray = []) {
|
|||||||
$kitsuRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/kitsu_request.log', Logger::NOTICE));
|
$kitsuRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/kitsu_request.log', Logger::NOTICE));
|
||||||
$malRequestLogger = new Logger('mal-request');
|
$malRequestLogger = new Logger('mal-request');
|
||||||
$malRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/mal_request.log', Logger::NOTICE));
|
$malRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/mal_request.log', Logger::NOTICE));
|
||||||
$container->setLogger($appLogger, 'default');
|
$container->setLogger($appLogger);
|
||||||
$container->setLogger($kitsuRequestLogger, 'kitsu-request');
|
$container->setLogger($kitsuRequestLogger, 'kitsu-request');
|
||||||
$container->setLogger($malRequestLogger, 'mal-request');
|
$container->setLogger($malRequestLogger, 'mal-request');
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php use Aviat\AnimeClient\API\Kitsu; ?>
|
<?php use Aviat\AnimeClient\API\Kitsu; ?>
|
||||||
<main class="details">
|
<main class="details fixed">
|
||||||
<section class="flex flex-no-wrap">
|
<section class="flex flex-no-wrap">
|
||||||
<div>
|
<div>
|
||||||
<img class="cover" width="284" src="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}.jpg") ?>" alt="" />
|
<img class="cover" width="284" src="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}.jpg") ?>" alt="" />
|
||||||
@ -40,6 +40,8 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
</section>
|
||||||
|
<section class="flex flex-no-wrap">
|
||||||
<?php if (array_key_exists('manga', $data['included'])): ?>
|
<?php if (array_key_exists('manga', $data['included'])): ?>
|
||||||
<div>
|
<div>
|
||||||
<h4>Manga</h4>
|
<h4>Manga</h4>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
"files": [
|
||||||
|
"src/constants.php",
|
||||||
"src/AnimeClient.php"
|
"src/AnimeClient.php"
|
||||||
],
|
],
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@ -22,7 +23,7 @@
|
|||||||
"aura/router": "^3.0",
|
"aura/router": "^3.0",
|
||||||
"aura/session": "^2.0",
|
"aura/session": "^2.0",
|
||||||
"aviat/banker": "^1.0.0",
|
"aviat/banker": "^1.0.0",
|
||||||
"aviat/ion": "^2.2.0",
|
"aviat/ion": "^2.3.0",
|
||||||
"maximebf/consolekit": "^1.0",
|
"maximebf/consolekit": "^1.0",
|
||||||
"monolog/monolog": "^1.0",
|
"monolog/monolog": "^1.0",
|
||||||
"psr/http-message": "~1.0",
|
"psr/http-message": "~1.0",
|
||||||
@ -51,9 +52,16 @@
|
|||||||
"build:css": "cd public && npm run build && cd ..",
|
"build:css": "cd public && npm run build && cd ..",
|
||||||
"clean": "vendor/bin/robo clean",
|
"clean": "vendor/bin/robo clean",
|
||||||
"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
|
"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
|
||||||
"docs": "vendor/bin/phpdox",
|
"phpstan": "phpstan analyse -l 4 -c phpstan.neon src tests ./console index.php",
|
||||||
"phpstan": "phpstan analyse src tests",
|
|
||||||
"watch:css": "cd public && npm run watch",
|
"watch:css": "cd public && npm run watch",
|
||||||
"test": "vendor/bin/phpunit"
|
"test": "vendor/bin/phpunit"
|
||||||
|
},
|
||||||
|
"scripts-descriptions": {
|
||||||
|
"build": "Generate the api docs",
|
||||||
|
"build:css": "Generate browser css",
|
||||||
|
"clean": "Remove documentation generation files and folders",
|
||||||
|
"coverage": "Generate a test coverage report",
|
||||||
|
"phpstan": "Run PHP Static analysis",
|
||||||
|
"test": "Run the unit tests"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
35
console
35
console
@ -2,30 +2,29 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
// Set up autoloader for third-party dependencies
|
// Set up autoloader for third-party dependencies
|
||||||
require_once realpath(__DIR__ . '/vendor/autoload.php');
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
use Aviat\AnimeClient\Command;
|
use Aviat\AnimeClient\Command;
|
||||||
|
|
||||||
$_SERVER['HTTP_HOST'] = 'localhost';
|
$_SERVER['HTTP_HOST'] = 'localhost';
|
||||||
|
|
||||||
// Define base directories
|
|
||||||
$APP_DIR = __DIR__ . '/app/';
|
|
||||||
$SRC_DIR = __DIR__ . '/src/';
|
|
||||||
$CONF_DIR = realpath("${APP_DIR}/config/");
|
|
||||||
|
|
||||||
// Unset 'constants'
|
|
||||||
unset($APP_DIR);
|
|
||||||
unset($SRC_DIR);
|
|
||||||
unset($CONF_DIR);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Start console script
|
// Start console script
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
$console = new \ConsoleKit\Console([
|
try
|
||||||
'cache-prime' => Command\CachePrime::class,
|
{
|
||||||
'cache-clear' => Command\CacheClear::class,
|
(new \ConsoleKit\Console([
|
||||||
'clear-cache' => Command\CacheClear::class,
|
'cache:clear' => Command\CacheClear::class,
|
||||||
'sync-lists' => Command\SyncKitsuWithMal::class,
|
'cache:prime' => Command\CachePrime::class,
|
||||||
]);
|
'lists:sync' => Command\SyncKitsuWithMal::class,
|
||||||
|
'cache-prime' => Command\CachePrime::class,
|
||||||
|
'cache-clear' => Command\CacheClear::class,
|
||||||
|
'clear-cache' => Command\CacheClear::class,
|
||||||
|
'sync-lists' => Command\SyncKitsuWithMal::class,
|
||||||
|
]))->run();
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$console->run();
|
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -40,7 +40,7 @@ $CONF_DIR = _dir($APP_DIR, 'config');
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Dependency Injection setup
|
// Dependency Injection setup
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
require_once $APPCONF_DIR . '/base_config.php'; // $base_config
|
$base_config = require $APPCONF_DIR . '/base_config.php';
|
||||||
$di = require $APP_DIR . '/bootstrap.php';
|
$di = require $APP_DIR . '/bootstrap.php';
|
||||||
|
|
||||||
$config = loadToml($CONF_DIR);
|
$config = loadToml($CONF_DIR);
|
||||||
|
9
phpstan.neon
Normal file
9
phpstan.neon
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
parameters:
|
||||||
|
autoload_files:
|
||||||
|
- %rootDir%/../../../tests/mocks.php
|
||||||
|
ignoreErrors:
|
||||||
|
- '#Access to an undefined property Aviat\\\Ion\\\Friend::\$[a-zA-Z0-9_]+#'
|
||||||
|
- '#Call to an undefined method Aviat\\\Ion\\\Friend::[a-zA-Z0-9_]+\(\)#'
|
||||||
|
- '#Call to an undefined method Aura\\\Html\\\HelperLocator::[a-zA-Z0-9_]+\(\)#'
|
||||||
|
- '#Undefined variable: \$var#'
|
||||||
|
- '#Property Amp\\Artax\\Internal\\RequestCycle::\$[a-zA-Z0-9_]+#'
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -55,7 +55,7 @@ class APIRequestBuilder {
|
|||||||
protected $defaultHeaders = [];
|
protected $defaultHeaders = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Valid HTTP request methos
|
* Valid HTTP request methods
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
|
protected $validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'];
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -17,7 +17,6 @@
|
|||||||
namespace Aviat\AnimeClient\API;
|
namespace Aviat\AnimeClient\API;
|
||||||
|
|
||||||
use Aviat\Banker\Pool;
|
use Aviat\Banker\Pool;
|
||||||
use Aviat\Ion\Di\ContainerAware;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper methods for dealing with the Cache
|
* Helper methods for dealing with the Cache
|
||||||
@ -25,7 +24,7 @@ use Aviat\Ion\Di\ContainerAware;
|
|||||||
trait CacheTrait {
|
trait CacheTrait {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Aviat\Banker\Pool
|
* @var Pool
|
||||||
*/
|
*/
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ trait CacheTrait {
|
|||||||
*
|
*
|
||||||
* @return Pool
|
* @return Pool
|
||||||
*/
|
*/
|
||||||
public function getCache()
|
public function getCache(): Pool
|
||||||
{
|
{
|
||||||
return $this->cache;
|
return $this->cache;
|
||||||
}
|
}
|
||||||
@ -54,20 +53,18 @@ trait CacheTrait {
|
|||||||
/**
|
/**
|
||||||
* Generate a hash as a cache key from the current method call
|
* Generate a hash as a cache key from the current method call
|
||||||
*
|
*
|
||||||
* @param object $object
|
* @param mixed $object
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param array $args
|
* @param array $args
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getHashForMethodCall($object, string $method, array $args = []): string
|
public function getHashForMethodCall($object, string $method, array $args = []): string
|
||||||
{
|
{
|
||||||
$classname = get_class($object);
|
|
||||||
$keyObj = [
|
$keyObj = [
|
||||||
'class' => $classname,
|
'class' => \get_class($object),
|
||||||
'method' => $method,
|
'method' => $method,
|
||||||
'args' => $args,
|
'args' => $args,
|
||||||
];
|
];
|
||||||
$hash = sha1(json_encode($keyObj));
|
return sha1(json_encode($keyObj));
|
||||||
return $hash;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -1,13 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Hummingbird Anime List Client
|
||||||
|
*
|
||||||
|
* An API client for Kitsu and MyAnimeList to manage anime and manga watch lists
|
||||||
|
*
|
||||||
|
* PHP version 7
|
||||||
|
*
|
||||||
|
* @package HummingbirdAnimeClient
|
||||||
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
* @copyright 2015 - 2018 Timothy J. Warren
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
|
* @version 4.0
|
||||||
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient\API;
|
namespace Aviat\AnimeClient\API;
|
||||||
|
|
||||||
use Amp\{
|
use Amp\{
|
||||||
CancellationToken, CancelledException, Deferred, Delayed, Emitter, Failure, Loop, NullCancellationToken, Promise, Success, TimeoutCancellationToken
|
CancellationToken,
|
||||||
|
CancelledException,
|
||||||
|
Deferred,
|
||||||
|
Delayed,
|
||||||
|
Emitter,
|
||||||
|
Failure,
|
||||||
|
Loop,
|
||||||
|
NullCancellationToken,
|
||||||
|
Promise,
|
||||||
|
Success,
|
||||||
|
TimeoutCancellationToken
|
||||||
|
};
|
||||||
|
use Amp\Artax\{
|
||||||
|
ConnectionInfo, Client, DnsException, HttpException, HttpSocketPool, MetaInfo, ParseException, RequestBody, Response, Request, SocketException, TimeoutException, TlsInfo, TooManyRedirectsException
|
||||||
};
|
};
|
||||||
use Amp\Artax\{ConnectionInfo, Client, HttpException, HttpSocketPool, MetaInfo, Response, Request, TlsInfo};
|
|
||||||
use Amp\Artax\Cookie\{
|
use Amp\Artax\Cookie\{
|
||||||
Cookie, CookieFormatException, CookieJar, NullCookieJar
|
Cookie,
|
||||||
|
CookieFormatException,
|
||||||
|
CookieJar,
|
||||||
|
NullCookieJar
|
||||||
};
|
};
|
||||||
use Amp\Artax\Internal\{
|
use Amp\Artax\Internal\{
|
||||||
CombinedCancellationToken, Parser, PublicSuffixList, RequestCycle
|
CombinedCancellationToken, Parser, PublicSuffixList, RequestCycle
|
||||||
@ -34,7 +63,7 @@ use function Amp\{
|
|||||||
* @see Client
|
* @see Client
|
||||||
*/
|
*/
|
||||||
final class HummingbirdClient implements Client {
|
final class HummingbirdClient implements Client {
|
||||||
const DEFAULT_USER_AGENT = 'Mozilla/5.0 (compatible; Artax)';
|
const DEFAULT_USER_AGENT = 'Hummingbird Anime Client/5.0';
|
||||||
|
|
||||||
private $cookieJar;
|
private $cookieJar;
|
||||||
private $socketPool;
|
private $socketPool;
|
||||||
@ -42,7 +71,7 @@ final class HummingbirdClient implements Client {
|
|||||||
private $hasZlib;
|
private $hasZlib;
|
||||||
private $options = [
|
private $options = [
|
||||||
self::OP_AUTO_ENCODING => true,
|
self::OP_AUTO_ENCODING => true,
|
||||||
self::OP_TRANSFER_TIMEOUT => 15000,
|
self::OP_TRANSFER_TIMEOUT => 60000,
|
||||||
self::OP_MAX_REDIRECTS => 5,
|
self::OP_MAX_REDIRECTS => 5,
|
||||||
self::OP_AUTO_REFERER => true,
|
self::OP_AUTO_REFERER => true,
|
||||||
self::OP_DISCARD_BODY => false,
|
self::OP_DISCARD_BODY => false,
|
||||||
@ -60,7 +89,7 @@ final class HummingbirdClient implements Client {
|
|||||||
$this->cookieJar = $cookieJar ?? new NullCookieJar;
|
$this->cookieJar = $cookieJar ?? new NullCookieJar;
|
||||||
$this->tlsContext = $tlsContext ?? new ClientTlsContext;
|
$this->tlsContext = $tlsContext ?? new ClientTlsContext;
|
||||||
$this->socketPool = $socketPool ?? new HttpSocketPool;
|
$this->socketPool = $socketPool ?? new HttpSocketPool;
|
||||||
$this->hasZlib = extension_loaded('zlib');
|
$this->hasZlib = \extension_loaded('zlib');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -44,7 +44,7 @@ class JsonAPI {
|
|||||||
* Inline all included data
|
* Inline all included data
|
||||||
*
|
*
|
||||||
* @param array $data - The raw JsonAPI response data
|
* @param array $data - The raw JsonAPI response data
|
||||||
* @return data
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function organizeData(array $data): array
|
public static function organizeData(array $data): array
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ class JsonAPI {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Reorganize included data
|
// Reorganize included data
|
||||||
$included = (array_key_exists('included', $data))
|
$included = array_key_exists('included', $data)
|
||||||
? static::organizeIncluded($data['included'])
|
? static::organizeIncluded($data['included'])
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ class JsonAPI {
|
|||||||
|
|
||||||
foreach ($data['data'] as $item)
|
foreach ($data['data'] as $item)
|
||||||
{
|
{
|
||||||
if (is_array($item) && array_key_exists('id', $item))
|
if (\is_array($item) && array_key_exists('id', $item))
|
||||||
{
|
{
|
||||||
$organized[$key][] = $item['id'];
|
$organized[$key][] = $item['id'];
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -18,7 +18,6 @@ namespace Aviat\AnimeClient\API\Kitsu;
|
|||||||
|
|
||||||
use const Aviat\AnimeClient\SESSION_SEGMENT;
|
use const Aviat\AnimeClient\SESSION_SEGMENT;
|
||||||
|
|
||||||
use Aviat\AnimeClient\AnimeClient;
|
|
||||||
use Aviat\AnimeClient\API\{
|
use Aviat\AnimeClient\API\{
|
||||||
CacheTrait,
|
CacheTrait,
|
||||||
Kitsu as K
|
Kitsu as K
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -177,7 +177,7 @@ trait KitsuTrait {
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Json::decode(wait($response->getBody()), TRUE);
|
return Json::decode(wait($response->getBody()));
|
||||||
}
|
}
|
||||||
catch (JsonException $e)
|
catch (JsonException $e)
|
||||||
{
|
{
|
||||||
@ -226,7 +226,7 @@ trait KitsuTrait {
|
|||||||
$response = $this->getResponse('POST', ...$args);
|
$response = $this->getResponse('POST', ...$args);
|
||||||
$validResponseCodes = [200, 201];
|
$validResponseCodes = [200, 201];
|
||||||
|
|
||||||
if ( ! in_array((int) $response->getStatus(), $validResponseCodes))
|
if ( ! \in_array((int) $response->getStatus(), $validResponseCodes, TRUE))
|
||||||
{
|
{
|
||||||
if ($logger)
|
if ($logger)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -763,7 +763,7 @@ class Model {
|
|||||||
* Get the mal id for the manga represented by the kitsu id
|
* Get the mal id for the manga represented by the kitsu id
|
||||||
* to enable updating MyAnimeList
|
* to enable updating MyAnimeList
|
||||||
*
|
*
|
||||||
* @param string $kitsuAnimeId The id of the anime on Kitsu
|
* @param string $kitsuMangaId The id of the manga on Kitsu
|
||||||
* @return string|null Returns the mal id if it exists, otherwise null
|
* @return string|null Returns the mal id if it exists, otherwise null
|
||||||
*/
|
*/
|
||||||
public function getMalIdForManga(string $kitsuMangaId)
|
public function getMalIdForManga(string $kitsuMangaId)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -31,7 +31,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
* @param array $item API library item
|
* @param array $item API library item
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function transform($item)
|
public function transform($item): array
|
||||||
{
|
{
|
||||||
$included = $item['included'];
|
$included = $item['included'];
|
||||||
$animeId = $item['relationships']['media']['data']['id'];
|
$animeId = $item['relationships']['media']['data']['id'];
|
||||||
@ -41,7 +41,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
sort($genres);
|
sort($genres);
|
||||||
|
|
||||||
$rating = (int) $item['attributes']['rating'] !== 0
|
$rating = (int) $item['attributes']['rating'] !== 0
|
||||||
? (int) 2 * $item['attributes']['rating']
|
? 2 * $item['attributes']['rating']
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
$total_episodes = array_key_exists('episodeCount', $anime) && (int) $anime['episodeCount'] !== 0
|
$total_episodes = array_key_exists('episodeCount', $anime) && (int) $anime['episodeCount'] !== 0
|
||||||
@ -97,7 +97,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
'rewatching' => (bool) $item['attributes']['reconsuming'],
|
'rewatching' => (bool) $item['attributes']['reconsuming'],
|
||||||
'rewatched' => (int) $item['attributes']['reconsumeCount'],
|
'rewatched' => (int) $item['attributes']['reconsumeCount'],
|
||||||
'user_rating' => $rating,
|
'user_rating' => $rating,
|
||||||
'private' => (bool) $item['attributes']['private'] ?? FALSE,
|
'private' => $item['attributes']['private'] ?? FALSE,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
* @param array $item Transformed library item
|
* @param array $item Transformed library item
|
||||||
* @return array API library item
|
* @return array API library item
|
||||||
*/
|
*/
|
||||||
public function untransform($item)
|
public function untransform($item): array
|
||||||
{
|
{
|
||||||
$privacy = (array_key_exists('private', $item) && $item['private']);
|
$privacy = (array_key_exists('private', $item) && $item['private']);
|
||||||
$rewatching = (array_key_exists('rewatching', $item) && $item['rewatching']);
|
$rewatching = (array_key_exists('rewatching', $item) && $item['rewatching']);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -33,7 +33,7 @@ class MangaListTransformer extends AbstractTransformer {
|
|||||||
* @param array $item manga entry item
|
* @param array $item manga entry item
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function transform($item)
|
public function transform($item): array
|
||||||
{
|
{
|
||||||
$included = $item['included'];
|
$included = $item['included'];
|
||||||
$mangaId = $item['relationships']['media']['data']['id'];
|
$mangaId = $item['relationships']['media']['data']['id'];
|
||||||
@ -43,7 +43,7 @@ class MangaListTransformer extends AbstractTransformer {
|
|||||||
sort($genres);
|
sort($genres);
|
||||||
|
|
||||||
$rating = (int) $item['attributes']['rating'] !== 0
|
$rating = (int) $item['attributes']['rating'] !== 0
|
||||||
? (int) 2 * $item['attributes']['rating']
|
? 2 * $item['attributes']['rating']
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
$totalChapters = ((int) $manga['chapterCount'] !== 0)
|
$totalChapters = ((int) $manga['chapterCount'] !== 0)
|
||||||
@ -109,9 +109,9 @@ class MangaListTransformer extends AbstractTransformer {
|
|||||||
* @param array $item
|
* @param array $item
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function untransform($item)
|
public function untransform($item): array
|
||||||
{
|
{
|
||||||
$rereading = (array_key_exists('rereading', $item)) && (bool)$item['rereading'];
|
$rereading = array_key_exists('rereading', $item) && (bool)$item['rereading'];
|
||||||
|
|
||||||
$map = [
|
$map = [
|
||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -27,7 +27,7 @@ interface ListItemInterface {
|
|||||||
* Create a list item
|
* Create a list item
|
||||||
*
|
*
|
||||||
* @param array $data -
|
* @param array $data -
|
||||||
* @return bool
|
* @return Request
|
||||||
*/
|
*/
|
||||||
public function create(array $data): Request;
|
public function create(array $data): Request;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ interface ListItemInterface {
|
|||||||
*
|
*
|
||||||
* @param string $id - The id of the list item to update
|
* @param string $id - The id of the list item to update
|
||||||
* @param array $data - The data with which to update the list item
|
* @param array $data - The data with which to update the list item
|
||||||
* @return Response
|
* @return Request
|
||||||
*/
|
*/
|
||||||
public function update(string $id, array $data): Request;
|
public function update(string $id, array $data): Request;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ interface ListItemInterface {
|
|||||||
* Delete a list item
|
* Delete a list item
|
||||||
*
|
*
|
||||||
* @param string $id - The id of the list item to delete
|
* @param string $id - The id of the list item to delete
|
||||||
* @return bool
|
* @return Request
|
||||||
*/
|
*/
|
||||||
public function delete(string $id): Request;
|
public function delete(string $id): Request;
|
||||||
}
|
}
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,11 +16,14 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\API;
|
namespace Aviat\AnimeClient\API;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\Kitsu\Enum\{
|
use Aviat\AnimeClient\API\Enum\{
|
||||||
AnimeWatchingStatus as KAWS,
|
AnimeWatchingStatus\Kitsu as KAWS,
|
||||||
MangaReadingStatus as KMRS
|
MangaReadingStatus\Kitsu as KMRS
|
||||||
|
};
|
||||||
|
use Aviat\AnimeClient\API\Enum\{
|
||||||
|
AnimeWatchingStatus\MAL as AnimeWatchingStatus,
|
||||||
|
MangaReadingStatus\MAL as MangaReadingStatus
|
||||||
};
|
};
|
||||||
use Aviat\AnimeClient\API\MAL\Enum\{AnimeWatchingStatus, MangaReadingStatus};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants and mappings for the My Anime List API
|
* Constants and mappings for the My Anime List API
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -38,6 +38,11 @@ class Model {
|
|||||||
*/
|
*/
|
||||||
protected $animeListTransformer;
|
protected $animeListTransformer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var MangaListTransformer
|
||||||
|
*/
|
||||||
|
protected $mangaListTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ListItem
|
* @var ListItem
|
||||||
*/
|
*/
|
||||||
@ -76,6 +81,8 @@ class Model {
|
|||||||
*/
|
*/
|
||||||
public function createListItem(array $data, string $type = 'anime'): Request
|
public function createListItem(array $data, string $type = 'anime'): Request
|
||||||
{
|
{
|
||||||
|
$createData = [];
|
||||||
|
|
||||||
if ($type === 'anime')
|
if ($type === 'anime')
|
||||||
{
|
{
|
||||||
$createData = [
|
$createData = [
|
||||||
@ -119,7 +126,7 @@ class Model {
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (array_key_exists($type, $list['myanimelist']))
|
return array_key_exists($type, $list['myanimelist'])
|
||||||
? $list['myanimelist'][$type]
|
? $list['myanimelist'][$type]
|
||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
@ -146,6 +153,8 @@ class Model {
|
|||||||
*/
|
*/
|
||||||
public function updateListItem(array $data, string $type = 'anime'): Request
|
public function updateListItem(array $data, string $type = 'anime'): Request
|
||||||
{
|
{
|
||||||
|
$updateData = [];
|
||||||
|
|
||||||
if ($type === 'anime')
|
if ($type === 'anime')
|
||||||
{
|
{
|
||||||
$updateData = $this->animeListTransformer->untransform($data);
|
$updateData = $this->animeListTransformer->untransform($data);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -34,7 +34,7 @@ class ParallelAPIRequest {
|
|||||||
/**
|
/**
|
||||||
* Add a request
|
* Add a request
|
||||||
*
|
*
|
||||||
* @param string|Request $request
|
* @param string|\Amp\Artax\Request $request
|
||||||
* @param string|number $key
|
* @param string|number $key
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
@ -53,7 +53,7 @@ class ParallelAPIRequest {
|
|||||||
/**
|
/**
|
||||||
* Add multiple requests
|
* Add multiple requests
|
||||||
*
|
*
|
||||||
* @param string[]|Request[] $requests
|
* @param string[]|\Amp\Artax\Request[] $requests
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function addRequests(array $requests): self
|
public function addRequests(array $requests): self
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\API;
|
namespace Aviat\AnimeClient\API;
|
||||||
|
|
||||||
use DOMDocument, DOMNode, DOMNodelist;
|
use DOMDocument, DOMNode, DOMNodeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XML <=> PHP Array codec
|
* XML <=> PHP Array codec
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -18,21 +18,6 @@ namespace Aviat\AnimeClient;
|
|||||||
|
|
||||||
use Yosymfony\Toml\Toml;
|
use Yosymfony\Toml\Toml;
|
||||||
|
|
||||||
if ( ! defined('SRC_DIR'))
|
|
||||||
{
|
|
||||||
\define('SRC_DIR', \realpath(__DIR__));
|
|
||||||
}
|
|
||||||
|
|
||||||
const SESSION_SEGMENT = 'Aviat\AnimeClient\Auth';
|
|
||||||
const DEFAULT_CONTROLLER = 'Aviat\AnimeClient\Controller\Index';
|
|
||||||
const DEFAULT_CONTROLLER_NAMESPACE = 'Aviat\AnimeClient\Controller';
|
|
||||||
const DEFAULT_LIST_CONTROLLER = 'Aviat\AnimeClient\Controller\Anime';
|
|
||||||
const DEFAULT_CONTROLLER_METHOD = 'index';
|
|
||||||
const NOT_FOUND_METHOD = 'notFound';
|
|
||||||
const ERROR_MESSAGE_METHOD = 'errorPage';
|
|
||||||
const SRC_DIR = SRC_DIR;
|
|
||||||
|
|
||||||
|
|
||||||
if ( ! \function_exists('Aviat\AnimeClient\loadToml'))
|
if ( ! \function_exists('Aviat\AnimeClient\loadToml'))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -19,11 +19,7 @@ namespace Aviat\AnimeClient\Command;
|
|||||||
use function Aviat\AnimeClient\loadToml;
|
use function Aviat\AnimeClient\loadToml;
|
||||||
|
|
||||||
use Aura\Session\SessionFactory;
|
use Aura\Session\SessionFactory;
|
||||||
use Aviat\AnimeClient\{
|
use Aviat\AnimeClient\Util;
|
||||||
AnimeClient,
|
|
||||||
Model,
|
|
||||||
Util
|
|
||||||
};
|
|
||||||
use Aviat\AnimeClient\API\CacheTrait;
|
use Aviat\AnimeClient\API\CacheTrait;
|
||||||
use Aviat\AnimeClient\API\{Kitsu, MAL};
|
use Aviat\AnimeClient\API\{Kitsu, MAL};
|
||||||
use Aviat\AnimeClient\API\Kitsu\KitsuRequestBuilder;
|
use Aviat\AnimeClient\API\Kitsu\KitsuRequestBuilder;
|
||||||
@ -67,7 +63,7 @@ class BaseCommand extends Command {
|
|||||||
$APP_DIR = realpath(__DIR__ . '/../../app');
|
$APP_DIR = realpath(__DIR__ . '/../../app');
|
||||||
$APPCONF_DIR = realpath("{$APP_DIR}/appConf/");
|
$APPCONF_DIR = realpath("{$APP_DIR}/appConf/");
|
||||||
$CONF_DIR = realpath("{$APP_DIR}/config/");
|
$CONF_DIR = realpath("{$APP_DIR}/config/");
|
||||||
require_once $APPCONF_DIR . '/base_config.php'; // $base_config
|
$base_config = require_once $APPCONF_DIR . '/base_config.php';
|
||||||
|
|
||||||
$config = loadToml($CONF_DIR);
|
$config = loadToml($CONF_DIR);
|
||||||
$config_array = array_merge($base_config, $config);
|
$config_array = array_merge($base_config, $config);
|
||||||
@ -85,7 +81,7 @@ class BaseCommand extends Command {
|
|||||||
$kitsu_request_logger->pushHandler(new RotatingFileHandler($APP_DIR . '/logs/kitsu_request-cli.log', Logger::NOTICE));
|
$kitsu_request_logger->pushHandler(new RotatingFileHandler($APP_DIR . '/logs/kitsu_request-cli.log', Logger::NOTICE));
|
||||||
$mal_request_logger = new Logger('mal-request');
|
$mal_request_logger = new Logger('mal-request');
|
||||||
$mal_request_logger->pushHandler(new RotatingFileHandler($APP_DIR . '/logs/mal_request-cli.log', Logger::NOTICE));
|
$mal_request_logger->pushHandler(new RotatingFileHandler($APP_DIR . '/logs/mal_request-cli.log', Logger::NOTICE));
|
||||||
$container->setLogger($app_logger, 'default');
|
$container->setLogger($app_logger);
|
||||||
$container->setLogger($kitsu_request_logger, 'kitsu-request');
|
$container->setLogger($kitsu_request_logger, 'kitsu-request');
|
||||||
$container->setLogger($mal_request_logger, 'mal-request');
|
$container->setLogger($mal_request_logger, 'mal-request');
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -51,7 +51,6 @@ class SyncKitsuWithMal extends BaseCommand {
|
|||||||
* @param array $args
|
* @param array $args
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \ConsoleKit\ConsoleException
|
|
||||||
*/
|
*/
|
||||||
public function execute(array $args, array $options = [])
|
public function execute(array $args, array $options = [])
|
||||||
{
|
{
|
||||||
@ -80,6 +79,7 @@ class SyncKitsuWithMal extends BaseCommand {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$kitsuCount = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$kitsuCount = $this->kitsuModel->{"get{$uType}ListCount"}();
|
$kitsuCount = $this->kitsuModel->{"get{$uType}ListCount"}();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -18,15 +18,20 @@ namespace Aviat\AnimeClient;
|
|||||||
|
|
||||||
use function Aviat\Ion\_dir;
|
use function Aviat\Ion\_dir;
|
||||||
|
|
||||||
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
|
use Aviat\Ion\Di\{
|
||||||
|
ContainerAware,
|
||||||
|
ContainerInterface
|
||||||
|
};
|
||||||
|
use Aviat\Ion\Di\Exception\{
|
||||||
|
ContainerException,
|
||||||
|
NotFoundException
|
||||||
|
};
|
||||||
use Aviat\Ion\Exception\DoubleRenderException;
|
use Aviat\Ion\Exception\DoubleRenderException;
|
||||||
use Aviat\Ion\View\{HtmlView, HttpView, JsonView};
|
use Aviat\Ion\View\{HtmlView, HttpView, JsonView};
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller base, defines output methods
|
* Controller base, defines output methods
|
||||||
*
|
|
||||||
* @property $response Response object
|
|
||||||
*/
|
*/
|
||||||
class Controller {
|
class Controller {
|
||||||
|
|
||||||
@ -46,22 +51,16 @@ class Controller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Request object
|
* Request object
|
||||||
* @var object $request
|
* @var \Psr\Http\Message\ServerRequestInterface $request
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response object
|
* Response object
|
||||||
* @var object $response
|
* @var \Psr\Http\Message\ResponseInterface $response
|
||||||
*/
|
*/
|
||||||
public $response;
|
public $response;
|
||||||
|
|
||||||
/**
|
|
||||||
* The api model for the current controller
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
protected $model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Url generation class
|
* Url generation class
|
||||||
* @var UrlGenerator
|
* @var UrlGenerator
|
||||||
@ -94,8 +93,8 @@ class Controller {
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param ContainerInterface $container
|
* @param ContainerInterface $container
|
||||||
* @throws \Aviat\Ion\Di\ContainerException
|
* @throws ContainerException
|
||||||
* @throws \Aviat\Ion\Di\NotFoundException
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container)
|
public function __construct(ContainerInterface $container)
|
||||||
{
|
{
|
||||||
@ -107,7 +106,7 @@ class Controller {
|
|||||||
$this->request = $container->get('request');
|
$this->request = $container->get('request');
|
||||||
$this->response = $container->get('response');
|
$this->response = $container->get('response');
|
||||||
|
|
||||||
$this->baseData = array_merge((array)$this->baseData, [
|
$this->baseData = array_merge($this->baseData, [
|
||||||
'url' => $auraUrlGenerator,
|
'url' => $auraUrlGenerator,
|
||||||
'urlGenerator' => $urlGenerator,
|
'urlGenerator' => $urlGenerator,
|
||||||
'auth' => $container->get('auth'),
|
'auth' => $container->get('auth'),
|
||||||
@ -146,8 +145,8 @@ class Controller {
|
|||||||
* Set the current url in the session as the target of a future redirect
|
* Set the current url in the session as the target of a future redirect
|
||||||
*
|
*
|
||||||
* @param string|null $url
|
* @param string|null $url
|
||||||
* @throws \Aviat\Ion\Di\ContainerException
|
* @throws ContainerException
|
||||||
* @throws \Aviat\Ion\Di\NotFoundException
|
* @throws NotFoundException
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setSessionRedirect(string $url = NULL)
|
public function setSessionRedirect(string $url = NULL)
|
||||||
@ -174,7 +173,7 @@ class Controller {
|
|||||||
if (null === $url)
|
if (null === $url)
|
||||||
{
|
{
|
||||||
$url = $util->isViewPage()
|
$url = $util->isViewPage()
|
||||||
? $this->request->url->get()
|
? $this->request->getUri()->__toString()
|
||||||
: $serverParams['HTTP_REFERER'];
|
: $serverParams['HTTP_REFERER'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -17,10 +17,8 @@
|
|||||||
namespace Aviat\AnimeClient\Controller;
|
namespace Aviat\AnimeClient\Controller;
|
||||||
|
|
||||||
use Aviat\AnimeClient\Controller as BaseController;
|
use Aviat\AnimeClient\Controller as BaseController;
|
||||||
use Aviat\AnimeClient\API\Kitsu\{
|
use Aviat\AnimeClient\API\Kitsu\Transformer\AnimeListTransformer;
|
||||||
Enum\AnimeWatchingStatus as KitsuWatchingStatus,
|
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Kitsu as KitsuWatchingStatus;
|
||||||
Transformer\AnimeListTransformer
|
|
||||||
};
|
|
||||||
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Json;
|
use Aviat\Ion\Json;
|
||||||
@ -35,22 +33,10 @@ class Anime extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The anime list model
|
* The anime list model
|
||||||
* @var object $model
|
* @var \Aviat\AnimeClient\Model\Anime $model
|
||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
/**
|
|
||||||
* Data to be sent to all routes in this controller
|
|
||||||
* @var array $baseData
|
|
||||||
*/
|
|
||||||
protected $baseData;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Data cache
|
|
||||||
* @var \Psr\Cache\CachePoolInterface
|
|
||||||
*/
|
|
||||||
protected $cache;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -158,7 +144,7 @@ class Anime extends BaseController {
|
|||||||
*/
|
*/
|
||||||
public function edit($id, $status = "all")
|
public function edit($id, $status = "all")
|
||||||
{
|
{
|
||||||
$item = $this->model->getLibraryItem($id, $status);
|
$item = $this->model->getLibraryItem($id);
|
||||||
$this->setSessionRedirect();
|
$this->setSessionRedirect();
|
||||||
|
|
||||||
$this->outputHTML('anime/edit', [
|
$this->outputHTML('anime/edit', [
|
||||||
@ -203,7 +189,7 @@ class Anime extends BaseController {
|
|||||||
|
|
||||||
if ($fullResult['statusCode'] === 200)
|
if ($fullResult['statusCode'] === 200)
|
||||||
{
|
{
|
||||||
$this->setFlashMessage("Successfully updated.", 'success');
|
$this->setFlashMessage('Successfully updated.', 'success');
|
||||||
$this->cache->clear();
|
$this->cache->clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -230,7 +216,7 @@ class Anime extends BaseController {
|
|||||||
$data = $this->request->getParsedBody();
|
$data = $this->request->getParsedBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->model->updateLibraryItem($data, $data);
|
$response = $this->model->updateLibraryItem($data);
|
||||||
|
|
||||||
$this->cache->clear();
|
$this->cache->clear();
|
||||||
$this->outputJSON($response['body'], $response['statusCode']);
|
$this->outputJSON($response['body'], $response['statusCode']);
|
||||||
@ -246,9 +232,9 @@ class Anime extends BaseController {
|
|||||||
$body = $this->request->getParsedBody();
|
$body = $this->request->getParsedBody();
|
||||||
$response = $this->model->deleteLibraryItem($body['id'], $body['mal_id']);
|
$response = $this->model->deleteLibraryItem($body['id'], $body['mal_id']);
|
||||||
|
|
||||||
if ((bool)$response === TRUE)
|
if ($response === TRUE)
|
||||||
{
|
{
|
||||||
$this->setFlashMessage("Successfully deleted anime.", 'success');
|
$this->setFlashMessage('Successfully deleted anime.', 'success');
|
||||||
$this->cache->clear();
|
$this->cache->clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -272,12 +258,14 @@ class Anime extends BaseController {
|
|||||||
|
|
||||||
if (empty($data))
|
if (empty($data))
|
||||||
{
|
{
|
||||||
return $this->notFound(
|
$this->notFound(
|
||||||
$this->config->get('whose_list') .
|
$this->config->get('whose_list') .
|
||||||
"'s Anime List · Anime · " .
|
"'s Anime List · Anime · " .
|
||||||
'Anime not found',
|
'Anime not found',
|
||||||
'Anime Not Found'
|
'Anime Not Found'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('characters', $data['included']))
|
if (array_key_exists('characters', $data['included']))
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -35,13 +35,15 @@ class Character extends BaseController {
|
|||||||
|
|
||||||
if (( ! array_key_exists('data', $rawData)) || empty($rawData['data']))
|
if (( ! array_key_exists('data', $rawData)) || empty($rawData['data']))
|
||||||
{
|
{
|
||||||
return $this->notFound(
|
$this->notFound(
|
||||||
$this->formatTitle(
|
$this->formatTitle(
|
||||||
'Characters',
|
'Characters',
|
||||||
'Character not found'
|
'Character not found'
|
||||||
),
|
),
|
||||||
'Character Not Found'
|
'Character Not Found'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = JsonAPI::organizeData($rawData);
|
$data = JsonAPI::organizeData($rawData);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -36,12 +36,6 @@ class Manga extends Controller {
|
|||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
/**
|
|
||||||
* Data to ve sent to all routes in this controller
|
|
||||||
* @var array $baseData
|
|
||||||
*/
|
|
||||||
protected $baseData;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -265,12 +259,13 @@ class Manga extends Controller {
|
|||||||
|
|
||||||
if (empty($data))
|
if (empty($data))
|
||||||
{
|
{
|
||||||
return $this->notFound(
|
$this->notFound(
|
||||||
$this->config->get('whose_list') .
|
$this->config->get('whose_list') .
|
||||||
"'s Manga List · Manga · " .
|
"'s Manga List · Manga · " .
|
||||||
'Manga not found',
|
'Manga not found',
|
||||||
'Manga Not Found'
|
'Manga Not Found'
|
||||||
);
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($data['included'] as $included)
|
foreach($data['included'] as $included)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -18,8 +18,8 @@ namespace Aviat\AnimeClient\Controller;
|
|||||||
|
|
||||||
use Aviat\AnimeClient\Controller as BaseController;
|
use Aviat\AnimeClient\Controller as BaseController;
|
||||||
use Aviat\AnimeClient\Model\{
|
use Aviat\AnimeClient\Model\{
|
||||||
manga as mangaModel,
|
Manga as MangaModel,
|
||||||
mangaCollection as mangaCollectionModel
|
MangaCollection as MangaCollectionModel
|
||||||
};
|
};
|
||||||
use Aviat\AnimeClient\UrlGenerator;
|
use Aviat\AnimeClient\UrlGenerator;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
@ -31,13 +31,13 @@ class MangaCollection extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The manga collection model
|
* The manga collection model
|
||||||
* @var mangaCollectionModel $mangaCollectionModel
|
* @var MangaCollectionModel $mangaCollectionModel
|
||||||
*/
|
*/
|
||||||
private $mangaCollectionModel;
|
private $mangaCollectionModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The manga API model
|
* The manga API model
|
||||||
* @var mangaModel $mangaModel
|
* @var MangaModel $mangaModel
|
||||||
*/
|
*/
|
||||||
private $mangaModel;
|
private $mangaModel;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,16 +16,10 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use const Aviat\AnimeClient\{
|
|
||||||
DEFAULT_CONTROLLER,
|
|
||||||
DEFAULT_CONTROLLER_NAMESPACE,
|
|
||||||
ERROR_MESSAGE_METHOD,
|
|
||||||
NOT_FOUND_METHOD,
|
|
||||||
SRC_DIR
|
|
||||||
};
|
|
||||||
|
|
||||||
use function Aviat\Ion\_dir;
|
use function Aviat\Ion\_dir;
|
||||||
|
|
||||||
|
use Aura\Router\Matcher;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\FailedResponseException;
|
use Aviat\AnimeClient\API\FailedResponseException;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Friend;
|
use Aviat\Ion\Friend;
|
||||||
@ -46,7 +40,7 @@ class Dispatcher extends RoutingBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The route matcher
|
* The route matcher
|
||||||
* @var object $matcher
|
* @var Matcher $matcher
|
||||||
*/
|
*/
|
||||||
protected $matcher;
|
protected $matcher;
|
||||||
|
|
||||||
@ -80,19 +74,22 @@ class Dispatcher extends RoutingBase {
|
|||||||
/**
|
/**
|
||||||
* Get the current route object, if one matches
|
* Get the current route object, if one matches
|
||||||
*
|
*
|
||||||
* @return object
|
* @return \Aura\Router\Route|false
|
||||||
*/
|
*/
|
||||||
public function getRoute()
|
public function getRoute()
|
||||||
{
|
{
|
||||||
$logger = $this->container->getLogger('default');
|
$logger = $this->container->getLogger();
|
||||||
|
|
||||||
$rawRoute = $this->request->getUri()->getPath();
|
$rawRoute = $this->request->getUri()->getPath();
|
||||||
$routePath = "/" . trim($rawRoute, '/');
|
$routePath = '/' . trim($rawRoute, '/');
|
||||||
|
|
||||||
$logger->info('Dispatcher - Routing data from get_route method');
|
if ($logger !== NULL)
|
||||||
$logger->info(print_r([
|
{
|
||||||
'route_path' => $routePath
|
$logger->info('Dispatcher - Routing data from get_route method');
|
||||||
], TRUE));
|
$logger->info(print_r([
|
||||||
|
'route_path' => $routePath
|
||||||
|
], TRUE));
|
||||||
|
}
|
||||||
|
|
||||||
return $this->matcher->match($this->request);
|
return $this->matcher->match($this->request);
|
||||||
}
|
}
|
||||||
@ -113,16 +110,19 @@ class Dispatcher extends RoutingBase {
|
|||||||
* @param object|null $route
|
* @param object|null $route
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __invoke($route = NULL)
|
public function __invoke($route = NULL): void
|
||||||
{
|
{
|
||||||
$logger = $this->container->getLogger('default');
|
$logger = $this->container->getLogger();
|
||||||
|
|
||||||
if (is_null($route))
|
if ($route === NULL)
|
||||||
{
|
{
|
||||||
$route = $this->getRoute();
|
$route = $this->getRoute();
|
||||||
|
|
||||||
$logger->info('Dispatcher - Route invoke arguments');
|
if ($logger !== NULL)
|
||||||
$logger->info(print_r($route, TRUE));
|
{
|
||||||
|
$logger->info('Dispatcher - Route invoke arguments');
|
||||||
|
$logger->info(print_r($route, TRUE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($route)
|
if ($route)
|
||||||
@ -153,7 +153,7 @@ class Dispatcher extends RoutingBase {
|
|||||||
* @throws \LogicException
|
* @throws \LogicException
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function processRoute($route)
|
protected function processRoute($route): array
|
||||||
{
|
{
|
||||||
if (array_key_exists('controller', $route->attributes))
|
if (array_key_exists('controller', $route->attributes))
|
||||||
{
|
{
|
||||||
@ -161,7 +161,7 @@ class Dispatcher extends RoutingBase {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new \LogicException("Missing controller");
|
throw new \LogicException('Missing controller');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the full namespace for a controller if a short name is given
|
// Get the full namespace for a controller if a short name is given
|
||||||
@ -187,8 +187,11 @@ class Dispatcher extends RoutingBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$logger = $this->container->getLogger('default');
|
$logger = $this->container->getLogger();
|
||||||
$logger->info(json_encode($params));
|
if ($logger !== NULL)
|
||||||
|
{
|
||||||
|
$logger->info(json_encode($params));
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'controller_name' => $controllerName,
|
'controller_name' => $controllerName,
|
||||||
@ -211,8 +214,11 @@ class Dispatcher extends RoutingBase {
|
|||||||
$segments = explode('/', $path);
|
$segments = explode('/', $path);
|
||||||
$controller = reset($segments);
|
$controller = reset($segments);
|
||||||
|
|
||||||
$logger = $this->container->getLogger('default');
|
$logger = $this->container->getLogger();
|
||||||
$logger->info('Controller: ' . $controller);
|
if ($logger !== NULL)
|
||||||
|
{
|
||||||
|
$logger->info('Controller: ' . $controller);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($controller))
|
if (empty($controller))
|
||||||
{
|
{
|
||||||
@ -240,7 +246,7 @@ class Dispatcher extends RoutingBase {
|
|||||||
|
|
||||||
foreach ($classFiles as $file)
|
foreach ($classFiles as $file)
|
||||||
{
|
{
|
||||||
$rawClassName = basename(str_replace(".php", "", $file));
|
$rawClassName = basename(str_replace('.php', '', $file));
|
||||||
$path = $this->string($rawClassName)->dasherize()->__toString();
|
$path = $this->string($rawClassName)->dasherize()->__toString();
|
||||||
$className = trim($defaultNamespace . '\\' . $rawClassName, '\\');
|
$className = trim($defaultNamespace . '\\' . $rawClassName, '\\');
|
||||||
|
|
||||||
@ -268,9 +274,12 @@ class Dispatcher extends RoutingBase {
|
|||||||
$controller = new $controllerName($this->container);
|
$controller = new $controllerName($this->container);
|
||||||
|
|
||||||
// Run the appropriate controller method
|
// Run the appropriate controller method
|
||||||
$logger->debug('Dispatcher - controller arguments', $params);
|
if ($logger !== NULL)
|
||||||
|
{
|
||||||
|
$logger->debug('Dispatcher - controller arguments', $params);
|
||||||
|
}
|
||||||
|
|
||||||
call_user_func_array([$controller, $method], $params);
|
\call_user_func_array([$controller, $method], $params);
|
||||||
}
|
}
|
||||||
catch (FailedResponseException $e)
|
catch (FailedResponseException $e)
|
||||||
{
|
{
|
||||||
@ -291,11 +300,14 @@ class Dispatcher extends RoutingBase {
|
|||||||
*/
|
*/
|
||||||
protected function getErrorParams()
|
protected function getErrorParams()
|
||||||
{
|
{
|
||||||
$logger = $this->container->getLogger('default');
|
$logger = $this->container->getLogger();
|
||||||
$failure = $this->matcher->getFailedRoute();
|
$failure = $this->matcher->getFailedRoute();
|
||||||
|
|
||||||
$logger->info('Dispatcher - failed route');
|
if ($logger !== NULL)
|
||||||
$logger->info(print_r($failure, TRUE));
|
{
|
||||||
|
$logger->info('Dispatcher - failed route');
|
||||||
|
$logger->info(print_r($failure, TRUE));
|
||||||
|
}
|
||||||
|
|
||||||
$actionMethod = ERROR_MESSAGE_METHOD;
|
$actionMethod = ERROR_MESSAGE_METHOD;
|
||||||
|
|
||||||
@ -360,9 +372,9 @@ 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))
|
$add = 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))
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,8 +16,11 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\{ArrayWrapper, StringWrapper};
|
use Aviat\Ion\{
|
||||||
|
ArrayWrapper, StringWrapper
|
||||||
|
};
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
use Aviat\Ion\Exception\ConfigException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper object to manage menu creation and selection
|
* Helper object to manage menu creation and selection
|
||||||
@ -80,6 +83,7 @@ class MenuGenerator extends UrlGenerator {
|
|||||||
* Generate the html structure of the menu selected
|
* Generate the html structure of the menu selected
|
||||||
*
|
*
|
||||||
* @param string $menu
|
* @param string $menu
|
||||||
|
* @throws ConfigException
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function generate($menu)
|
public function generate($menu)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,10 +16,13 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
|
use Aviat\Ion\StringWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base model for api interaction
|
* Base model for api interaction
|
||||||
*/
|
*/
|
||||||
class API extends AbstractModel {
|
class API {
|
||||||
|
use StringWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to use the MAL api
|
* Whether to use the MAL api
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\Kitsu;
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Json;
|
|
||||||
use PDO;
|
use PDO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +26,7 @@ class AnimeCollection extends Collection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Anime API Model
|
* Anime API Model
|
||||||
* @var object $animeModel
|
* @var Anime $animeModel
|
||||||
*/
|
*/
|
||||||
protected $animeModel;
|
protected $animeModel;
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ class AnimeCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCollection()
|
public function getCollection(): array
|
||||||
{
|
{
|
||||||
$rawCollection = $this->getCollectionFromDatabase();
|
$rawCollection = $this->getCollectionFromDatabase();
|
||||||
|
|
||||||
@ -74,7 +72,7 @@ class AnimeCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getMediaTypeList()
|
public function getMediaTypeList(): array
|
||||||
{
|
{
|
||||||
$output = [];
|
$output = [];
|
||||||
|
|
||||||
@ -93,13 +91,13 @@ class AnimeCollection extends Collection {
|
|||||||
/**
|
/**
|
||||||
* Get item from collection for editing
|
* Get item from collection for editing
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param string $id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCollectionEntry($id)
|
public function getCollectionEntry($id): array
|
||||||
{
|
{
|
||||||
$query = $this->db->from('anime_set')
|
$query = $this->db->from('anime_set')
|
||||||
->where('hummingbird_id', (int)$id)
|
->where('hummingbird_id', $id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return $query->fetch(PDO::FETCH_ASSOC);
|
return $query->fetch(PDO::FETCH_ASSOC);
|
||||||
@ -110,7 +108,7 @@ class AnimeCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getCollectionFromDatabase()
|
private function getCollectionFromDatabase(): array
|
||||||
{
|
{
|
||||||
if ( ! $this->validDatabase)
|
if ( ! $this->validDatabase)
|
||||||
{
|
{
|
||||||
@ -134,7 +132,7 @@ class AnimeCollection extends Collection {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function add($data)
|
public function add($data): void
|
||||||
{
|
{
|
||||||
$anime = (object)$this->animeModel->getAnimeById($data['id']);
|
$anime = (object)$this->animeModel->getAnimeById($data['id']);
|
||||||
$this->db->set([
|
$this->db->set([
|
||||||
@ -160,7 +158,7 @@ class AnimeCollection extends Collection {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function update($data)
|
public function update($data): void
|
||||||
{
|
{
|
||||||
// If there's no id to update, don't update
|
// If there's no id to update, don't update
|
||||||
if ( ! array_key_exists('hummingbird_id', $data))
|
if ( ! array_key_exists('hummingbird_id', $data))
|
||||||
@ -182,7 +180,7 @@ class AnimeCollection extends Collection {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($data)
|
public function delete($data): void
|
||||||
{
|
{
|
||||||
// If there's no id to update, don't delete
|
// If there's no id to update, don't delete
|
||||||
if ( ! array_key_exists('hummingbird_id', $data))
|
if ( ! array_key_exists('hummingbird_id', $data))
|
||||||
@ -203,7 +201,7 @@ class AnimeCollection extends Collection {
|
|||||||
* @param int $kitsuId
|
* @param int $kitsuId
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get($kitsuId)
|
public function get($kitsuId): array
|
||||||
{
|
{
|
||||||
$query = $this->db->from('anime_set')
|
$query = $this->db->from('anime_set')
|
||||||
->where('hummingbird_id', $kitsuId)
|
->where('hummingbird_id', $kitsuId)
|
||||||
@ -215,13 +213,14 @@ class AnimeCollection extends Collection {
|
|||||||
/**
|
/**
|
||||||
* Update genre information for selected anime
|
* Update genre information for selected anime
|
||||||
*
|
*
|
||||||
* @param int $animeId The current anime
|
* @param string $animeId The current anime
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function updateGenre($animeId)
|
private function updateGenre($animeId): void
|
||||||
{
|
{
|
||||||
$genreInfo = $this->getGenreData();
|
$genreInfo = $this->getGenreData();
|
||||||
extract($genreInfo);
|
$genres = $genreInfo['genres'];
|
||||||
|
$links = $genreInfo['links'];
|
||||||
|
|
||||||
// Get api information
|
// Get api information
|
||||||
$anime = $this->animeModel->getAnimeById($animeId);
|
$anime = $this->animeModel->getAnimeById($animeId);
|
||||||
@ -229,7 +228,7 @@ class AnimeCollection extends Collection {
|
|||||||
foreach ($anime['genres'] as $genre)
|
foreach ($anime['genres'] as $genre)
|
||||||
{
|
{
|
||||||
// Add genres that don't currently exist
|
// Add genres that don't currently exist
|
||||||
if ( ! in_array($genre, $genres))
|
if ( ! \in_array($genre, $genres, TRUE))
|
||||||
{
|
{
|
||||||
$this->db->set('genre', $genre)
|
$this->db->set('genre', $genre)
|
||||||
->insert('genres');
|
->insert('genres');
|
||||||
@ -248,7 +247,7 @@ class AnimeCollection extends Collection {
|
|||||||
|
|
||||||
if (array_key_exists($animeId, $links))
|
if (array_key_exists($animeId, $links))
|
||||||
{
|
{
|
||||||
if ( ! in_array($flippedGenres[$genre], $links[$animeId]))
|
if ( ! \in_array($flippedGenres[$genre], $links[$animeId], TRUE))
|
||||||
{
|
{
|
||||||
$this->db->set($insertArray)->insert('genre_anime_set_link');
|
$this->db->set($insertArray)->insert('genre_anime_set_link');
|
||||||
}
|
}
|
||||||
@ -265,7 +264,7 @@ class AnimeCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getGenreData()
|
private function getGenreData(): array
|
||||||
{
|
{
|
||||||
$genres = [];
|
$genres = [];
|
||||||
$links = [];
|
$links = [];
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,8 +16,7 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use Aviat\AnimeClient\Model\DB;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
|
|
||||||
use PDO;
|
use PDO;
|
||||||
use PDOException;
|
use PDOException;
|
||||||
|
|
||||||
@ -26,8 +25,6 @@ use PDOException;
|
|||||||
*/
|
*/
|
||||||
class Collection extends DB {
|
class Collection extends DB {
|
||||||
|
|
||||||
use ContainerAware;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the database is valid for querying
|
* Whether the database is valid for querying
|
||||||
* @var boolean
|
* @var boolean
|
||||||
@ -47,11 +44,7 @@ class Collection extends DB {
|
|||||||
{
|
{
|
||||||
$this->db = \Query($this->dbConfig['collection']);
|
$this->db = \Query($this->dbConfig['collection']);
|
||||||
}
|
}
|
||||||
catch (PDOException $e)
|
catch (PDOException $e) {}
|
||||||
{
|
|
||||||
//$this->validDatabase = FALSE;
|
|
||||||
//return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is database valid? If not, set a flag so the
|
// Is database valid? If not, set a flag so the
|
||||||
// app can be run without a valid database
|
// app can be run without a valid database
|
||||||
@ -81,7 +74,7 @@ class Collection extends DB {
|
|||||||
* @param array $filter
|
* @param array $filter
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getGenreList($filter = [])
|
public function getGenreList(array $filter = []): array
|
||||||
{
|
{
|
||||||
$this->db->select('hummingbird_id, genre')
|
$this->db->select('hummingbird_id, genre')
|
||||||
->from('genre_anime_set_link gl')
|
->from('genre_anime_set_link gl')
|
||||||
@ -112,7 +105,7 @@ class Collection extends DB {
|
|||||||
|
|
||||||
if (array_key_exists($id, $output))
|
if (array_key_exists($id, $output))
|
||||||
{
|
{
|
||||||
array_push($output[$id], $genre);
|
$output[$id][] = $genre;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -17,16 +17,19 @@
|
|||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
|
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
|
||||||
|
use Aviat\Ion\{ArrayWrapper, StringWrapper};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base model for database interaction
|
* Base model for database interaction
|
||||||
*/
|
*/
|
||||||
class DB extends AbstractModel {
|
class DB {
|
||||||
|
use ArrayWrapper;
|
||||||
use ContainerAware;
|
use ContainerAware;
|
||||||
|
use StringWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The query builder object
|
* The query builder object
|
||||||
* @var object $db
|
* @var \Query\Query_Builder_Interface
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,9 +16,7 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\Kitsu;
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Json;
|
|
||||||
use PDO;
|
use PDO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +26,7 @@ class MangaCollection extends Collection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Manga API Model
|
* Manga API Model
|
||||||
* @var object $mangaModel
|
* @var Manga $mangaModel
|
||||||
*/
|
*/
|
||||||
protected $mangaModel;
|
protected $mangaModel;
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ class MangaCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCollection()
|
public function getCollection(): array
|
||||||
{
|
{
|
||||||
$rawCollection = $this->getCollectionFromDatabase();
|
$rawCollection = $this->getCollectionFromDatabase();
|
||||||
|
|
||||||
@ -74,7 +72,7 @@ class MangaCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getMediaTypeList()
|
public function getMediaTypeList(): array
|
||||||
{
|
{
|
||||||
$output = [];
|
$output = [];
|
||||||
|
|
||||||
@ -96,10 +94,10 @@ class MangaCollection extends Collection {
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCollectionEntry($id)
|
public function getCollectionEntry($id): array
|
||||||
{
|
{
|
||||||
$query = $this->db->from('anime_set')
|
$query = $this->db->from('anime_set')
|
||||||
->where('hummingbird_id', (int)$id)
|
->where('hummingbird_id', $id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return $query->fetch(PDO::FETCH_ASSOC);
|
return $query->fetch(PDO::FETCH_ASSOC);
|
||||||
@ -110,7 +108,7 @@ class MangaCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getCollectionFromDatabase()
|
private function getCollectionFromDatabase(): array
|
||||||
{
|
{
|
||||||
if ( ! $this->validDatabase)
|
if ( ! $this->validDatabase)
|
||||||
{
|
{
|
||||||
@ -134,7 +132,7 @@ class MangaCollection extends Collection {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function add($data)
|
public function add($data): void
|
||||||
{
|
{
|
||||||
$anime = (object)$this->mangaModel->getMangaById($data['id']);
|
$anime = (object)$this->mangaModel->getMangaById($data['id']);
|
||||||
$this->db->set([
|
$this->db->set([
|
||||||
@ -160,7 +158,7 @@ class MangaCollection extends Collection {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function update($data)
|
public function update($data): void
|
||||||
{
|
{
|
||||||
// If there's no id to update, don't update
|
// If there's no id to update, don't update
|
||||||
if ( ! array_key_exists('hummingbird_id', $data))
|
if ( ! array_key_exists('hummingbird_id', $data))
|
||||||
@ -182,7 +180,7 @@ class MangaCollection extends Collection {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($data)
|
public function delete($data): void
|
||||||
{
|
{
|
||||||
// If there's no id to update, don't delete
|
// If there's no id to update, don't delete
|
||||||
if ( ! array_key_exists('hummingbird_id', $data))
|
if ( ! array_key_exists('hummingbird_id', $data))
|
||||||
@ -200,10 +198,10 @@ class MangaCollection extends Collection {
|
|||||||
/**
|
/**
|
||||||
* Get the details of a collection item
|
* Get the details of a collection item
|
||||||
*
|
*
|
||||||
* @param int $kitsuId
|
* @param string $kitsuId
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get($kitsuId)
|
public function get($kitsuId): array
|
||||||
{
|
{
|
||||||
$query = $this->db->from('manga_set')
|
$query = $this->db->from('manga_set')
|
||||||
->where('hummingbird_id', $kitsuId)
|
->where('hummingbird_id', $kitsuId)
|
||||||
@ -215,21 +213,22 @@ class MangaCollection extends Collection {
|
|||||||
/**
|
/**
|
||||||
* Update genre information for selected manga
|
* Update genre information for selected manga
|
||||||
*
|
*
|
||||||
* @param int $mangaId The current manga
|
* @param string $mangaId The current manga
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function updateGenre($mangaId)
|
private function updateGenre($mangaId): void
|
||||||
{
|
{
|
||||||
$genreInfo = $this->getGenreData();
|
$genreInfo = $this->getGenreData();
|
||||||
extract($genreInfo);
|
$genres = $genreInfo['genres'];
|
||||||
|
$links = $genreInfo['links'];
|
||||||
|
|
||||||
// Get api information
|
// Get api information
|
||||||
$manga = $this->mangaModel->getMangaById($mangaId);
|
$manga = $this->mangaModel->getMangaById($mangaId);
|
||||||
|
|
||||||
foreach ($anime['genres'] as $genre)
|
foreach ($manga['genres'] as $genre)
|
||||||
{
|
{
|
||||||
// Add genres that don't currently exist
|
// Add genres that don't currently exist
|
||||||
if ( ! in_array($genre, $genres))
|
if ( ! \in_array($genre, $genres, TRUE))
|
||||||
{
|
{
|
||||||
$this->db->set('genre', $genre)
|
$this->db->set('genre', $genre)
|
||||||
->insert('genres');
|
->insert('genres');
|
||||||
@ -248,7 +247,7 @@ class MangaCollection extends Collection {
|
|||||||
|
|
||||||
if (array_key_exists($mangaId, $links))
|
if (array_key_exists($mangaId, $links))
|
||||||
{
|
{
|
||||||
if ( ! in_array($flippedGenres[$genre], $links[$mangaId]))
|
if ( ! \in_array($flippedGenres[$genre], $links[$mangaId], TRUE))
|
||||||
{
|
{
|
||||||
$this->db->set($insertArray)->insert('genre_manga_set_link');
|
$this->db->set($insertArray)->insert('genre_manga_set_link');
|
||||||
}
|
}
|
||||||
@ -265,7 +264,7 @@ class MangaCollection extends Collection {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getGenreData()
|
private function getGenreData(): array
|
||||||
{
|
{
|
||||||
$genres = [];
|
$genres = [];
|
||||||
$links = [];
|
$links = [];
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,19 +8,19 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\StringWrapper;
|
const DEFAULT_CONTROLLER = Controller\Index::class;
|
||||||
|
const DEFAULT_CONTROLLER_METHOD = 'index';
|
||||||
/**
|
const DEFAULT_CONTROLLER_NAMESPACE = Controller::class;
|
||||||
* Base class for Models
|
const DEFAULT_LIST_CONTROLLER = Controller\Anime::class;
|
||||||
*/
|
const ERROR_MESSAGE_METHOD = 'errorPage';
|
||||||
abstract class AbstractModel {
|
const NOT_FOUND_METHOD = 'notFound';
|
||||||
use StringWrapper;
|
const SESSION_SEGMENT = 'Aviat\AnimeClient\Auth';
|
||||||
}
|
const SRC_DIR = __DIR__;
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -116,7 +116,7 @@ class APIRequestBuilderTest extends TestCase {
|
|||||||
'foo' => [
|
'foo' => [
|
||||||
'bar' => 1,
|
'bar' => 1,
|
||||||
'baz' => [2, 3, 4],
|
'baz' => [2, 3, 4],
|
||||||
'bar' => [
|
'bazbar' => [
|
||||||
'a' => 1,
|
'a' => 1,
|
||||||
'b' => 2
|
'b' => 2
|
||||||
]
|
]
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -20,6 +20,9 @@ use Aviat\AnimeClient\API\CacheTrait;
|
|||||||
use Aviat\AnimeClient\Tests\AnimeClientTestCase;
|
use Aviat\AnimeClient\Tests\AnimeClientTestCase;
|
||||||
|
|
||||||
class CacheTraitTest extends AnimeClientTestCase {
|
class CacheTraitTest extends AnimeClientTestCase {
|
||||||
|
|
||||||
|
protected $testClass;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Tests\API;
|
namespace Aviat\AnimeClient\Tests\API;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\{APIRequestBuilder, ParallelAPIRequest};
|
use Aviat\AnimeClient\API\ParallelAPIRequest;
|
||||||
use Aviat\Ion\Friend;
|
use Aviat\Ion\Friend;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
@ -25,8 +25,9 @@ class ParallelAPIRequestTest extends TestCase {
|
|||||||
public function testAddStringUrlRequest()
|
public function testAddStringUrlRequest()
|
||||||
{
|
{
|
||||||
$requester = new ParallelAPIRequest();
|
$requester = new ParallelAPIRequest();
|
||||||
|
$requester->addRequest('https://httpbin.org');
|
||||||
|
|
||||||
$friend = new Friend($requester);
|
$friend = new Friend($requester);
|
||||||
$friend->addRequest('https://httpbin.org');
|
|
||||||
|
|
||||||
$this->assertEquals($friend->requests, ['https://httpbin.org']);
|
$this->assertEquals($friend->requests, ['https://httpbin.org']);
|
||||||
}
|
}
|
||||||
@ -39,8 +40,9 @@ class ParallelAPIRequestTest extends TestCase {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$requester = new ParallelAPIRequest();
|
$requester = new ParallelAPIRequest();
|
||||||
|
$requester->addRequests($requests);
|
||||||
|
|
||||||
$friend = new Friend($requester);
|
$friend = new Friend($requester);
|
||||||
$friend->addRequests($requests);
|
|
||||||
|
|
||||||
$this->assertEquals($friend->requests, $requests);
|
$this->assertEquals($friend->requests, $requests);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -29,9 +29,9 @@ use Zend\Diactoros\{
|
|||||||
ServerRequestFactory
|
ServerRequestFactory
|
||||||
};
|
};
|
||||||
|
|
||||||
define('ROOT_DIR', __DIR__ . '/../');
|
\define('ROOT_DIR', __DIR__ . '/../');
|
||||||
define('TEST_DATA_DIR', __DIR__ . '/test_data');
|
\define('TEST_DATA_DIR', __DIR__ . '/test_data');
|
||||||
define('TEST_VIEW_DIR', __DIR__ . '/test_views');
|
\define('TEST_VIEW_DIR', __DIR__ . '/test_views');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for TestCases
|
* Base class for TestCases
|
||||||
@ -141,8 +141,8 @@ class AnimeClientTestCase extends TestCase {
|
|||||||
'_FILES' => $_FILES
|
'_FILES' => $_FILES
|
||||||
];
|
];
|
||||||
|
|
||||||
$request = call_user_func_array(
|
$request = \call_user_func_array(
|
||||||
['Zend\Diactoros\ServerRequestFactory', 'fromGlobals'],
|
[ServerRequestFactory::class, 'fromGlobals'],
|
||||||
array_merge($default, $supers)
|
array_merge($default, $supers)
|
||||||
);
|
);
|
||||||
$this->container->setInstance('request', $request);
|
$this->container->setInstance('request', $request);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -59,30 +59,30 @@ class ControllerTest extends AnimeClientTestCase {
|
|||||||
$this->container->setInstance('config', $config);
|
$this->container->setInstance('config', $config);
|
||||||
|
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
'Aviat\AnimeClient\Controller',
|
Controller::class,
|
||||||
new AnimeController($this->container)
|
new AnimeController($this->container)
|
||||||
);
|
);
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
'Aviat\AnimeClient\Controller',
|
Controller::class,
|
||||||
new MangaController($this->container)
|
new MangaController($this->container)
|
||||||
);
|
);
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
'Aviat\AnimeClient\Controller',
|
Controller::class,
|
||||||
new CharacterController($this->container)
|
new CharacterController($this->container)
|
||||||
);
|
);
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
'Aviat\AnimeClient\Controller',
|
Controller::class,
|
||||||
new AnimeCollectionController($this->container)
|
new AnimeCollectionController($this->container)
|
||||||
);
|
);
|
||||||
$this->assertInstanceOf(
|
$this->assertInstanceOf(
|
||||||
'Aviat\AnimeClient\Controller',
|
Controller::class,
|
||||||
new MangaCollectionController($this->container)
|
new MangaCollectionController($this->container)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBaseControllerSanity()
|
public function testBaseControllerSanity()
|
||||||
{
|
{
|
||||||
$this->assertTrue(is_object($this->BaseController));
|
$this->assertTrue(\is_object($this->BaseController));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormatTitle()
|
public function testFormatTitle()
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -180,14 +180,6 @@ class DispatcherTest extends AnimeClientTestCase {
|
|||||||
'action' => ['login'],
|
'action' => ['login'],
|
||||||
'verb' => 'get'
|
'verb' => 'get'
|
||||||
],
|
],
|
||||||
'index' => [
|
|
||||||
'path' => '/',
|
|
||||||
'action' => ['redirect'],
|
|
||||||
'params' => [
|
|
||||||
'url' => '', // Determined by config
|
|
||||||
'code' => '301'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'index' => [
|
'index' => [
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
'action' => ['redirect'],
|
'action' => ['redirect'],
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
@ -33,7 +33,7 @@ class MenuGeneratorTest extends AnimeClientTestCase {
|
|||||||
public function testSanity()
|
public function testSanity()
|
||||||
{
|
{
|
||||||
$generator = new MenuGenerator($this->container);
|
$generator = new MenuGenerator($this->container);
|
||||||
$this->assertInstanceOf('Aviat\AnimeClient\MenuGenerator', $generator);
|
$this->assertInstanceOf(MenuGenerator::class, $generator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParseConfig()
|
public function testParseConfig()
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
* @copyright 2015 - 2017 Timothy J. Warren
|
* @copyright 2015 - 2018 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 4.0
|
* @version 4.0
|
||||||
* @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
Loading…
Reference in New Issue
Block a user