From c9f5964d5e065ae9f3f127f89fe3afb3b9fa0764 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Tue, 20 Dec 2016 12:58:37 -0500 Subject: [PATCH] Ugly progress commit --- .gitlab-ci.yml | 9 +++ app/bootstrap.php | 26 ++++---- app/config/routes.php | 4 +- app/views/main-menu.php | 2 +- build/header_comment.txt | 8 +-- build/update_header_comments.php | 22 +++---- composer.json | 3 + console | 20 +----- index.php | 7 ++- migrations/20150616181750_first_migration.php | 2 +- src/AnimeClient.php | 7 ++- src/Command/BaseCommand.php | 10 +-- src/Command/CacheImages.php | 8 +-- src/Command/ClearCache.php | 8 +-- src/Controller.php | 30 ++++----- src/Controller/Anime.php | 12 ++-- src/Controller/Collection.php | 8 +-- src/Controller/Manga.php | 16 ++--- src/Dispatcher.php | 47 +++++++------- src/Helper/Menu.php | 8 +-- src/Model/API.php | 61 ++++++++----------- src/Model/Anime.php | 16 ++--- src/Model/AnimeCollection.php | 8 +-- src/Model/Collection.php | 8 +-- src/Model/DB.php | 8 +-- src/Model/Manga.php | 12 ++-- src/Util.php | 7 ++- tests/DispatcherTest.php | 8 +-- 28 files changed, 179 insertions(+), 206 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e294bfa6..2709e948 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,15 @@ test:7: image: php:7 script: - phpunit -c build + +test:7.1: + before_script: + - bash build/docker_install.sh > /dev/null + - curl -sS https://getcomposer.org/installer | php + - php composer.phar install --no-dev + image: php:7.1 + script: + - phpunit -c build test:hhvm: before_script: diff --git a/app/bootstrap.php b/app/bootstrap.php index f7d48ae9..fdc8e0da 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ @@ -19,16 +19,14 @@ namespace Aviat\AnimeClient; use Aura\Html\HelperLocatorFactory; use Aura\Router\RouterContainer; use Aura\Session\SessionFactory; -use Monolog\Logger; -use Monolog\Handler\RotatingFileHandler; -use Zend\Diactoros\ServerRequestFactory; -use Zend\Diactoros\Response; - +use Aviat\AnimeClient\API\Kitsu\Auth as KitsuAuth; +use Aviat\AnimeClient\Model; +use Aviat\Ion\Cache\CacheManager; use Aviat\Ion\Config; use Aviat\Ion\Di\Container; -use Aviat\Ion\Cache\CacheManager; -use Aviat\AnimeClient\Auth\HummingbirdAuth; -use Aviat\AnimeClient\Model; +use Monolog\Handler\RotatingFileHandler; +use Monolog\Logger; +use Zend\Diactoros\{Response, ServerRequestFactory}; // ----------------------------------------------------------------------------- // Setup DI container @@ -115,9 +113,9 @@ return function(array $config_array = []) { }); // Miscellaneous Classes - $container->set('auth', function($container) { + /* $container->set('auth', function($container) { return new HummingbirdAuth($container); - }); + }); */ $container->set('url-generator', function($container) { return new UrlGenerator($container); }); diff --git a/app/config/routes.php b/app/config/routes.php index ea536ddd..6e272f29 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -147,7 +147,7 @@ return [ // --------------------------------------------------------------------- 'cache_purge' => [ 'path' => '/cache_purge', - 'action' => 'clear_cache', + 'action' => 'clearCache', 'controller' => AnimeClient::DEFAULT_CONTROLLER_NAMESPACE, 'verb' => 'get', ], @@ -159,7 +159,7 @@ return [ ], 'login.post' => [ 'path' => '/login', - 'action' => 'login_action', + 'action' => 'loginAction', 'controller' => AnimeClient::DEFAULT_CONTROLLER_NAMESPACE, 'verb' => 'post', ], diff --git a/app/views/main-menu.php b/app/views/main-menu.php index 8a852a30..be89435e 100644 --- a/app/views/main-menu.php +++ b/app/views/main-menu.php @@ -1,4 +1,4 @@ - +

diff --git a/build/header_comment.txt b/build/header_comment.txt index 24806616..506ee880 100644 --- a/build/header_comment.txt +++ b/build/header_comment.txt @@ -1,15 +1,15 @@ /** - * Hummingbird Anime Client + * Anime List Client * - * An API client for Hummingbird to manage anime and manga watch lists + * An API client for Kitsu and MyAnimeList to manage anime and manga watch lists * * PHP version 7 * - * @package HummingbirdAnimeClient + * @package AnimeListClient * @author Timothy J. Warren * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/build/update_header_comments.php b/build/update_header_comments.php index 7aa9554c..1f6cdaa2 100644 --- a/build/update_header_comments.php +++ b/build/update_header_comments.php @@ -1,11 +1,11 @@ register(); require _dir($CONF_DIR, 'base_config.php'); // $base_config $di = require _dir($APP_DIR, 'bootstrap.php'); -$config = AnimeClient::load_toml($CONF_DIR); +$config = AnimeClient::loadToml($CONF_DIR); $config_array = array_merge($base_config, $config); $container = $di($config_array); diff --git a/migrations/20150616181750_first_migration.php b/migrations/20150616181750_first_migration.php index df1d219d..361941c1 100644 --- a/migrations/20150616181750_first_migration.php +++ b/migrations/20150616181750_first_migration.php @@ -1,4 +1,4 @@ - * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ @@ -57,7 +57,7 @@ class BaseCommand extends Command { $CONF_DIR = realpath(__DIR__ . '/../../app/config/'); require_once $CONF_DIR . '/base_config.php'; // $base_config - $config = AnimeClient::load_toml($CONF_DIR); + $config = AnimeClient::loadToml($CONF_DIR); $config_array = array_merge($base_config, $config); $di = function ($config_array) { diff --git a/src/Command/CacheImages.php b/src/Command/CacheImages.php index bdb03683..c3923133 100644 --- a/src/Command/CacheImages.php +++ b/src/Command/CacheImages.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/src/Command/ClearCache.php b/src/Command/ClearCache.php index 14c8f2f7..b49ea685 100644 --- a/src/Command/ClearCache.php +++ b/src/Command/ClearCache.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/src/Controller.php b/src/Controller.php index f5e27f1f..7abfe2dd 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -16,14 +16,8 @@ namespace Aviat\AnimeClient; -use Aviat\Ion\Di\ -{ - ContainerAware, ContainerInterface -}; -use Aviat\Ion\View\ -{ - HtmlView, HttpView, JsonView -}; +use Aviat\Ion\Di\{ContainerAware, ContainerInterface}; +use Aviat\Ion\View\{HtmlView, HttpView, JsonView}; use InvalidArgumentException; /** @@ -103,7 +97,7 @@ class Controller { $this->response = $container->get('response'); $this->base_data['url'] = $auraUrlGenerator; $this->base_data['urlGenerator'] = $urlGenerator; - $this->base_data['auth'] = $container->get('auth'); + // $this->base_data['auth'] = $container->get('auth'); $this->base_data['config'] = $this->config; $this->urlGenerator = $urlGenerator; @@ -189,7 +183,7 @@ class Controller { $target = $this->session->get('redirect_url'); if (empty($target)) { - $this->not_found(); + $this->notFound(); } else { @@ -234,8 +228,8 @@ class Controller { $data = array_merge($this->base_data, $data); } - $route = $router->get_route(); - $data['route_path'] = $route ? $router->get_route()->path : ''; + $route = $router->getRoute(); + $data['route_path'] = $route ? $router->getRoute()->path : ''; $template_path = _dir($this->config->get('view_path'), "{$template}.php"); @@ -301,7 +295,7 @@ class Controller { * * @return void */ - public function login_action() + public function loginAction() { $auth = $this->container->get('auth'); $post = $this->request->getParsedBody(); @@ -331,7 +325,7 @@ class Controller { * * @return void */ - public function not_found() + public function notFound() { $this->outputHTML('404', [ 'title' => 'Sorry, page not found' @@ -347,7 +341,7 @@ class Controller { * @param string $long_message * @return void */ - public function error_page($http_code, $title, $message, $long_message = "") + public function errorPage($http_code, $title, $message, $long_message = "") { $this->outputHTML('error', [ 'title' => $title, @@ -364,7 +358,7 @@ class Controller { * @param string $type * @return void */ - public function set_flash_message($message, $type = "info") + public function setFlashMessage($message, $type = "info") { $this->session->setFlash('message', [ 'message_type' => $type, @@ -377,7 +371,7 @@ class Controller { * * @return void */ - public function clear_cache() + public function clearCache() { $this->cache->purge(); $this->outputHTML('blank', [ @@ -394,7 +388,7 @@ class Controller { * @param string $message * @return string */ - protected function show_message($view, $type, $message) + protected function showMessage($view, $type, $message) { return $this->load_partial($view, 'message', [ 'message_type' => $type, diff --git a/src/Controller/Anime.php b/src/Controller/Anime.php index 7ebf31a4..03b7712c 100644 --- a/src/Controller/Anime.php +++ b/src/Controller/Anime.php @@ -1,24 +1,24 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ namespace Aviat\AnimeClient\Controller; use Aviat\AnimeClient\Controller as BaseController; -use Aviat\AnimeClient\Hummingbird\Enum\AnimeWatchingStatus; -use Aviat\AnimeClient\Hummingbird\Transformer\AnimeListTransformer; +use Aviat\AnimeClient\Kitsu\Enum\AnimeWatchingStatus; +use Aviat\AnimeClient\Kitsu\Transformer\AnimeListTransformer; use Aviat\Ion\Di\ContainerInterface; /** diff --git a/src/Controller/Collection.php b/src/Controller/Collection.php index 893e5a80..9bdc30c8 100644 --- a/src/Controller/Collection.php +++ b/src/Controller/Collection.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/src/Controller/Manga.php b/src/Controller/Manga.php index c3027af8..e88152c7 100644 --- a/src/Controller/Manga.php +++ b/src/Controller/Manga.php @@ -1,34 +1,34 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ namespace Aviat\AnimeClient\Controller; use Aviat\AnimeClient\Controller; -use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus; -use Aviat\AnimeClient\Hummingbird\Transformer\MangaListTransformer; +use Aviat\AnimeClient\API\Kitsu\Enum\MangaReadingStatus; +use Aviat\AnimeClient\API\Kitsu\Transformer\MangaListTransformer; use Aviat\AnimeClient\Model\Manga as MangaModel; use Aviat\Ion\Di\ContainerInterface; -use Aviat\Ion\Json; +use Aviat\Ion\{Json, StringWrapper}; /** * Controller for manga list */ class Manga extends Controller { - use \Aviat\Ion\StringWrapper; + use StringWrapper; /** * The manga model diff --git a/src/Dispatcher.php b/src/Dispatcher.php index a168f745..8a67eff0 100644 --- a/src/Dispatcher.php +++ b/src/Dispatcher.php @@ -19,7 +19,6 @@ namespace Aviat\AnimeClient; use Aviat\Ion\Di\ContainerInterface; use Aviat\Ion\Friend; - /** * Basic routing/ dispatch */ @@ -61,7 +60,7 @@ class Dispatcher extends RoutingBase { $this->matcher = $container->get('aura-router')->getMatcher(); $this->request = $container->get('request'); - $this->output_routes = $this->_setup_routes(); + $this->output_routes = $this->_setupRoutes(); } /** @@ -69,7 +68,7 @@ class Dispatcher extends RoutingBase { * * @return object */ - public function get_route() + public function getRoute() { $logger = $this->container->getLogger('default'); @@ -89,7 +88,7 @@ class Dispatcher extends RoutingBase { * * @return array */ - public function get_output_routes() + public function getOutputRoutes() { return $this->output_routes; } @@ -107,7 +106,7 @@ class Dispatcher extends RoutingBase { if (is_null($route)) { - $route = $this->get_route(); + $route = $this->getRoute(); $logger->debug('Dispatcher - Route invoke arguments'); $logger->debug(print_r($route, TRUE)); @@ -115,23 +114,23 @@ class Dispatcher extends RoutingBase { if ($route) { - $parsed = $this->process_route(new Friend($route)); - $controller_name = $parsed['controller_name']; - $action_method = $parsed['action_method']; + $parsed = $this->processRoute(new Friend($route)); + $controllerName = $parsed['controller_name']; + $actionMethod = $parsed['action_method']; $params = $parsed['params']; } else { // If not route was matched, return an appropriate http // error message - $error_route = $this->get_error_params(); - $controller_name = AnimeClient::DEFAULT_CONTROLLER; - $action_method = $error_route['action_method']; + $error_route = $this->getErrorParams(); + $controllerName = AnimeClient::DEFAULT_CONTROLLER; + $actionMethod = $error_route['action_method']; $params = $error_route['params']; } // Actually instantiate the controller - $this->call($controller_name, $action_method, $params); + $this->call($controllerName, $actionMethod, $params); } /** @@ -142,7 +141,7 @@ class Dispatcher extends RoutingBase { * @throws \LogicException * @return array */ - protected function process_route($route) + protected function processRoute($route) { if (array_key_exists('controller', $route->attributes)) { @@ -156,7 +155,7 @@ class Dispatcher extends RoutingBase { // Get the full namespace for a controller if a short name is given if (strpos($controller_name, '\\') === FALSE) { - $map = $this->get_controller_list(); + $map = $this->getControllerList(); $controller_name = $map[$controller_name]; } @@ -191,7 +190,7 @@ class Dispatcher extends RoutingBase { * * @return string */ - public function get_controller() + public function getController() { $route_type = $this->__get('default_list'); $request_uri = $this->request->getUri()->getPath(); @@ -213,13 +212,13 @@ class Dispatcher extends RoutingBase { * * @return array */ - public function get_controller_list() + public function getControllerList() { $default_namespace = AnimeClient::DEFAULT_CONTROLLER_NAMESPACE; $path = str_replace('\\', '/', $default_namespace); $path = str_replace('Aviat/AnimeClient/', '', $path); $path = trim($path, '/'); - $actual_path = realpath(\_dir(AnimeClient::SRC_DIR, $path)); + $actual_path = realpath(_dir(AnimeClient::SRC_DIR, $path)); $class_files = glob("{$actual_path}/*.php"); $controllers = []; @@ -240,16 +239,16 @@ class Dispatcher extends RoutingBase { * Create the controller object and call the appropriate * method * - * @param string $controller_name - The full namespace of the controller class + * @param string $controllerName - The full namespace of the controller class * @param string $method * @param array $params * @return void */ - protected function call($controller_name, $method, array $params) + protected function call($controllerName, $method, array $params) { $logger = $this->container->getLogger('default'); - $controller = new $controller_name($this->container); + $controller = new $controllerName($this->container); // Run the appropriate controller method $logger->debug('Dispatcher - controller arguments'); @@ -263,7 +262,7 @@ class Dispatcher extends RoutingBase { * * @return array|false */ - protected function get_error_params() + protected function getErrorParams() { $logger = $this->container->getLogger('default'); $failure = $this->matcher->getFailedRoute(); @@ -309,9 +308,9 @@ class Dispatcher extends RoutingBase { * * @return array */ - protected function _setup_routes() + protected function _setupRoutes() { - $route_type = $this->get_controller(); + $route_type = $this->getController(); // Add routes $routes = []; @@ -320,7 +319,7 @@ class Dispatcher extends RoutingBase { $path = $route['path']; unset($route['path']); - $controller_map = $this->get_controller_list(); + $controller_map = $this->getControllerList(); $controller_class = (array_key_exists($route_type, $controller_map)) ? $controller_map[$route_type] : AnimeClient::DEFAULT_CONTROLLER; diff --git a/src/Helper/Menu.php b/src/Helper/Menu.php index ddc623dc..b045d67f 100644 --- a/src/Helper/Menu.php +++ b/src/Helper/Menu.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/src/Model/API.php b/src/Model/API.php index bb501e41..ef4bd113 100644 --- a/src/Model/API.php +++ b/src/Model/API.php @@ -1,23 +1,23 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ namespace Aviat\AnimeClient\Model; use Aviat\AnimeClient\AnimeClient; -use Aviat\Ion\Di\ContainerInterface; +use Aviat\Ion\Di\{ContainerAware, ContainerInterface}; use Aviat\Ion\Model; use GuzzleHttp\Client; use GuzzleHttp\Cookie\CookieJar; @@ -36,7 +36,7 @@ use Psr\Http\Message\ResponseInterface; */ class API extends Model { - use \Aviat\Ion\Di\ContainerAware; + use ContainerAware; /** * Config manager @@ -68,6 +68,12 @@ class API extends Model { */ protected $cache; + /** + * Default settings for Guzzle + * @var array + */ + protected $connectionDefaults = []; + /** * Constructor * @@ -93,15 +99,16 @@ class API extends Model { 'base_uri' => $this->base_url, 'cookies' => TRUE, 'http_errors' => FALSE, - 'defaults' => [ + 'defaults' => array_merge([ 'cookies' => $this->cookieJar, 'headers' => [ - 'User-Agent' => "Tim's Anime Client/3.0", - 'Accept-Encoding' => 'application/json' + 'User-Agent' => "Tim's Anime Client/4.0", + 'Accept-Encoding' => 'application/vnd.api+json', + 'Content-Type' => 'application/vnd.api+json' ], 'timeout' => 25, 'connect_timeout' => 25 - ] + ], $this->connectionDefaults) ]); } @@ -116,12 +123,19 @@ class API extends Model { { $valid_methods = [ 'get', + 'getAsync', 'delete', + 'deleteAsync', 'head', + 'headAsync', 'options', + 'optionsAsync', 'patch', + 'patchAsync', 'post', - 'put' + 'postAsync', + 'put', + 'putAsync' ]; if ( ! in_array($method, $valid_methods)) @@ -172,31 +186,6 @@ class API extends Model { array_multisort($sort, SORT_ASC, $array); } - /** - * Attempt login via the api - * - * @codeCoverageIgnore - * @param string $username - * @param string $password - * @return string|false - */ - public function authenticate(string $username, string $password) - { - $response = $this->post(AnimeClient::HUMMINGBIRD_AUTH_URL, [ - 'form_params' => [ - 'username' => $username, - 'password' => $password - ] - ]); - - if ($response->getStatusCode() === 201) - { - return json_decode((string)$response->getBody(), TRUE); - } - - return FALSE; - } - /** * Dummy function that should be abstract. Is not abstract because * this class is used concretely for authorizing API calls diff --git a/src/Model/Anime.php b/src/Model/Anime.php index 67a21acd..5b3077e7 100644 --- a/src/Model/Anime.php +++ b/src/Model/Anime.php @@ -1,23 +1,23 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ namespace Aviat\AnimeClient\Model; -use Aviat\AnimeClient\Hummingbird\Enum\AnimeWatchingStatus; -use Aviat\AnimeClient\Hummingbird\Transformer\AnimeListTransformer; +use Aviat\AnimeClient\API\Kitsu\Enum\AnimeWatchingStatus; +use Aviat\AnimeClient\API\Kitsu\Transformer\AnimeListTransformer; use Aviat\Ion\Json; /** @@ -36,7 +36,7 @@ class Anime extends API { * The base url for api requests * @var string $base_url */ - protected $base_url = "https://hummingbird.me/api/v1/"; + protected $base_url = "https://kitsu.io/api/edge/"; /** * Map of API status constants to display constants @@ -226,7 +226,7 @@ class Anime extends API { $config['query']['auth_token'] = $auth->get_auth_token(); } - $response = $this->get("users/{$username}/library", $config); + $response = $this->get("library-entries?filter[media_type]=Anime&filter[user_id]=2644&filter[status]=1,2&include=media", $config); $output = $this->transform($status, $response); $util = $this->container->get('util'); diff --git a/src/Model/AnimeCollection.php b/src/Model/AnimeCollection.php index fc7fe4c1..7449daaa 100644 --- a/src/Model/AnimeCollection.php +++ b/src/Model/AnimeCollection.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/src/Model/Collection.php b/src/Model/Collection.php index 776f67c8..a712fadc 100644 --- a/src/Model/Collection.php +++ b/src/Model/Collection.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/src/Model/DB.php b/src/Model/DB.php index a75a6cb8..3acd9b77 100644 --- a/src/Model/DB.php +++ b/src/Model/DB.php @@ -1,16 +1,16 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ diff --git a/src/Model/Manga.php b/src/Model/Manga.php index 88aa4f3c..75ecb2d8 100644 --- a/src/Model/Manga.php +++ b/src/Model/Manga.php @@ -1,23 +1,23 @@ * @copyright 2015 - 2016 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 3.1 + * @version 4.0 * @link https://github.com/timw4mail/HummingBirdAnimeClient */ namespace Aviat\AnimeClient\Model; -use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus; -use Aviat\AnimeClient\Hummingbird\Transformer; +use Aviat\AnimeClient\API\Kitsu\Enum\MangaReadingStatus; +use Aviat\AnimeClient\API\Kitsu\Transformer; use Aviat\Ion\Json; use GuzzleHttp\Cookie\SetCookie; use RuntimeException; diff --git a/src/Util.php b/src/Util.php index 309e981a..9031de31 100644 --- a/src/Util.php +++ b/src/Util.php @@ -18,14 +18,15 @@ namespace Aviat\AnimeClient; use abeautifulsite\SimpleImage; use Aviat\Ion\ConfigInterface; -use Aviat\Ion\Di\ContainerInterface; +use Aviat\Ion\Di\{ContainerAware, ContainerInterface}; +use DomainException; /** * Utility method class */ class Util { - use \Aviat\Ion\Di\ContainerAware; + use ContainerAware; /** * Routes that don't require a second navigation level @@ -164,7 +165,7 @@ class Util { } else { - throw new \DomainException("Couldn't cache images because they couldn't be downloaded."); + throw new DomainException("Couldn't cache images because they couldn't be downloaded."); } // Resize the image diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 142ac98d..cd3abf83 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -137,7 +137,7 @@ class DispatcherTest extends AnimeClient_TestCase { // Check route setup $this->assertEquals($config['routes'], $this->config->get('routes'), "Incorrect route path"); - $this->assertTrue(is_array($this->router->get_output_routes())); + $this->assertTrue(is_array($this->router->getOutputRoutes())); // Check environment variables $this->assertEquals($uri, $request->getServerParams()['REQUEST_URI']); @@ -145,10 +145,10 @@ class DispatcherTest extends AnimeClient_TestCase { // Make sure the route is an anime type //$this->assertTrue($matcher->count() > 0, "0 routes"); - $this->assertEquals($controller, $this->router->get_controller(), "Incorrect Route type"); + $this->assertEquals($controller, $this->router->getController(), "Incorrect Route type"); // Make sure the route matches, by checking that it is actually an object - $route = $this->router->get_route(); + $route = $this->router->getRoute(); $this->assertInstanceOf('Aura\\Router\\Route', $route, "Route is invalid, not matched"); } @@ -252,6 +252,6 @@ class DispatcherTest extends AnimeClient_TestCase { public function testGetControllerList($config, $expected) { $this->_set_up($config, '/', 'localhost'); - $this->assertEquals($expected, $this->router->get_controller_list()); + $this->assertEquals($expected, $this->router->getControllerList()); } } \ No newline at end of file