Various code style tweaks

This commit is contained in:
Timothy Warren 2019-12-09 13:13:31 -05:00
parent 245e1b4344
commit 6044a676a6
20 changed files with 364 additions and 125 deletions

3
.gitignore vendored
View File

@ -145,4 +145,5 @@ public/images/avatars/**
public/images/manga/**
public/images/characters/**
public/images/people/**
public/mal_mappings.json
public/mal_mappings.json
.phpunit.result.cache

View File

@ -44,10 +44,13 @@ return static function ($configArray = []) {
$appLogger = new Logger('animeclient');
$appLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/app.log', Logger::NOTICE));
$anilistRequestLogger = new Logger('anilist-request');
$anilistRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/anilist_request.log', Logger::NOTICE));
$kitsuRequestLogger = new Logger('kitsu-request');
$kitsuRequestLogger->pushHandler(new RotatingFileHandler(__DIR__ . '/logs/kitsu_request.log', Logger::NOTICE));
$container->setLogger($appLogger);
$container->setLogger($anilistRequestLogger, 'anilist-request');
$container->setLogger($kitsuRequestLogger, 'kitsu-request');
@ -62,7 +65,7 @@ return static function ($configArray = []) {
});
// Create Cache Object
$container->set('cache', static function($container) {
$container->set('cache', static function($container): Pool {
$logger = $container->getLogger();
$config = $container->get('config')->get('cache');
return new Pool($config, $logger);
@ -117,12 +120,12 @@ return static function ($configArray = []) {
});
// Miscellaneous helper methods
$container->set('util', static function($container) {
$container->set('util', static function($container): Util {
return new Util($container);
});
// Models
$container->set('kitsu-model', static function($container) {
$container->set('kitsu-model', static function($container): Kitsu\Model {
$requestBuilder = new KitsuRequestBuilder();
$requestBuilder->setLogger($container->getLogger('kitsu-request'));
@ -138,7 +141,7 @@ return static function ($configArray = []) {
$model->setCache($cache);
return $model;
});
$container->set('anilist-model', static function($container) {
$container->set('anilist-model', static function($container): Anilist\Model {
$requestBuilder = new Anilist\AnilistRequestBuilder();
$requestBuilder->setLogger($container->getLogger('anilist-request'));
@ -153,9 +156,6 @@ return static function ($configArray = []) {
return $model;
});
$container->set('api-model', static function($container) {
return new Model\API($container);
});
$container->set('anime-model', static function($container) {
return new Model\Anime($container);
});

View File

@ -15,41 +15,5 @@
<issueHandlers>
<LessSpecificReturnType errorLevel="info" />
<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives -->
<DeprecatedMethod errorLevel="info" />
<DeprecatedProperty errorLevel="info" />
<DeprecatedClass errorLevel="info" />
<DeprecatedConstant errorLevel="info" />
<DeprecatedFunction errorLevel="info" />
<DeprecatedInterface errorLevel="info" />
<DeprecatedTrait errorLevel="info" />
<InternalMethod errorLevel="info" />
<InternalProperty errorLevel="info" />
<InternalClass errorLevel="info" />
<MissingClosureReturnType errorLevel="info" />
<MissingReturnType errorLevel="info" />
<MissingPropertyType errorLevel="info" />
<InvalidDocblock errorLevel="info" />
<MisplacedRequiredParam errorLevel="info" />
<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />
<MissingClosureParamType errorLevel="info" />
<MissingParamType errorLevel="info" />
<RedundantCondition errorLevel="info" />
<DocblockTypeContradiction errorLevel="info" />
<RedundantConditionGivenDocblockType errorLevel="info" />
<UnresolvableInclude errorLevel="info" />
<RawObjectIteration errorLevel="info" />
<InvalidStringClass errorLevel="info" />
</issueHandlers>
</psalm>

View File

@ -100,7 +100,7 @@ final class AnimeListTransformer extends AbstractTransformer {
'title' => $title,
'titles' => $titles,
'slug' => $anime['slug'],
'show_type' => $this->string($anime['subtype'])->upperCaseFirst()->__toString(),
'show_type' => (string)$this->string($anime['subtype'])->upperCaseFirst(),
'cover_image' => $anime['posterImage']['small'],
'genres' => $genres,
'streaming_links' => $streamingLinks,

View File

@ -89,14 +89,14 @@ final class AnimeTransformer extends AbstractTransformer {
if ( ! empty($characters['main']))
{
uasort($characters['main'], function ($a, $b) {
uasort($characters['main'], static function ($a, $b) {
return $a['name'] <=> $b['name'];
});
}
if ( ! empty($characters['supporting']))
{
uasort($characters['supporting'], function ($a, $b) {
uasort($characters['supporting'], static function ($a, $b) {
return $a['name'] <=> $b['name'];
});
}
@ -114,7 +114,7 @@ final class AnimeTransformer extends AbstractTransformer {
'genres' => $item['genres'],
'id' => $item['id'],
'included' => $item['included'],
'show_type' => $this->string($item['showType'])->upperCaseFirst()->__toString(),
'show_type' => (string)$this->string($item['showType'])->upperCaseFirst(),
'slug' => $item['slug'],
'staff' => $staff,
'status' => Kitsu::getAiringStatus($item['startDate'], $item['endDate']),

View File

@ -46,7 +46,7 @@ class BaseCommand extends Command {
* @param string $message
* @return void
*/
protected function echoBox($message)
protected function echoBox($message): void
{
try
{
@ -82,7 +82,7 @@ class BaseCommand extends Command {
$configArray = array_replace_recursive($baseConfig, $config, $overrideConfig);
$di = static function ($configArray) use ($APP_DIR) {
$di = static function ($configArray) use ($APP_DIR): Container {
$container = new Container();
// -------------------------------------------------------------------------
@ -91,16 +91,19 @@ class BaseCommand extends Command {
$app_logger = new Logger('animeclient');
$app_logger->pushHandler(new RotatingFileHandler($APP_DIR . '/logs/app-cli.log', Logger::NOTICE));
$kitsu_request_logger = new Logger('kitsu-request');
$kitsu_request_logger->pushHandler(new RotatingFileHandler($APP_DIR . '/logs/kitsu_request-cli.log', Logger::NOTICE));
$anilistRequestLogger = new Logger('anilist-request');
$anilistRequestLogger->pushHandler(new RotatingFileHandler($APP_DIR . '/logs/anilist_request-cli.log', Logger::NOTICE));
$container->setLogger($app_logger);
$container->setLogger($anilistRequestLogger, 'anilist-request');
$container->setLogger($kitsu_request_logger, 'kitsu-request');
// Create Config Object
$container->set('config', static function() use ($configArray) {
$container->set('config', static function() use ($configArray): Config {
return new Config($configArray);
});
@ -126,7 +129,7 @@ class BaseCommand extends Command {
$_FILES
);
});
$container->set('response', static function() {
$container->set('response', static function(): Response {
return new Response;
});
@ -136,7 +139,7 @@ class BaseCommand extends Command {
});
// Models
$container->set('kitsu-model', static function($container) {
$container->set('kitsu-model', static function($container): Kitsu\Model {
$requestBuilder = new KitsuRequestBuilder();
$requestBuilder->setLogger($container->getLogger('kitsu-request'));
@ -152,7 +155,7 @@ class BaseCommand extends Command {
$model->setCache($cache);
return $model;
});
$container->set('anilist-model', static function ($container) {
$container->set('anilist-model', static function ($container): Anilist\Model {
$requestBuilder = new Anilist\AnilistRequestBuilder();
$requestBuilder->setLogger($container->getLogger('anilist-request'));
@ -166,21 +169,21 @@ class BaseCommand extends Command {
return $model;
});
$container->set('settings-model', static function($container) {
$container->set('settings-model', static function($container): Model\Settings {
$model = new Model\Settings($container->get('config'));
$model->setContainer($container);
return $model;
});
$container->set('auth', static function($container) {
$container->set('auth', static function($container): Kitsu\Auth {
return new Kitsu\Auth($container);
});
$container->set('url-generator', static function($container) {
$container->set('url-generator', static function($container): UrlGenerator {
return new UrlGenerator($container);
});
$container->set('util', static function($container) {
$container->set('util', static function($container): Util {
return new Util($container);
});

View File

@ -16,6 +16,9 @@
namespace Aviat\AnimeClient\Command;
use Aviat\Ion\Di\Exception\ContainerException;
use Aviat\Ion\Di\Exception\NotFoundException;
/**
* Clears the API Cache
*/
@ -25,15 +28,15 @@ final class CacheClear extends BaseCommand {
*
* @param array $args
* @param array $options
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
public function execute(array $args, array $options = []): void
{
$this->setContainer($this->setupContainer());
$cache = $this->container->get('cache');
$cache->clear();
$this->container->get('cache')->clear();
$this->echoBox('API Cache has been cleared.');
}

View File

@ -16,6 +16,9 @@
namespace Aviat\AnimeClient\Command;
use Aviat\Ion\Di\Exception\ContainerException;
use Aviat\Ion\Di\Exception\NotFoundException;
/**
* Clears the API Cache
*/
@ -25,8 +28,8 @@ final class CachePrime extends BaseCommand {
*
* @param array $args
* @param array $options
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
public function execute(array $args, array $options = []): void
@ -50,8 +53,9 @@ final class CachePrime extends BaseCommand {
$userIdItem->save();
}
// Prime anime list cache
$kitsuModel = $this->container->get('kitsu-model');
// Prime anime list cache
$kitsuModel->getFullOrganizedAnimeList();
// Prime manga list cache

View File

@ -16,8 +16,12 @@
namespace Aviat\AnimeClient\Command;
use Aviat\AnimeClient\API\
{Anilist\MissingIdException, FailedResponseException, JsonAPI, ParallelAPIRequest};
use Aviat\AnimeClient\API\{
Anilist\MissingIdException,
FailedResponseException,
JsonAPI,
ParallelAPIRequest
};
use Aviat\AnimeClient\API\Anilist\Transformer\{
AnimeListTransformer as AALT,
MangaListTransformer as AMLT

View File

@ -18,9 +18,19 @@ namespace Aviat\AnimeClient;
use function Aviat\Ion\_dir;
use Aura\Router\Generator;
use Aura\Session\Segment;
use Aviat\AnimeClient\API\Kitsu\Auth;
use Aviat\Ion\ConfigInterface;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Aviat\Ion\Di\{
ContainerAware,
ContainerInterface
ContainerInterface,
Exception\ContainerException,
Exception\NotFoundException
};
use Aviat\Ion\Exception\DoubleRenderException;
use Aviat\Ion\View\{HtmlView, HttpView, JsonView};
@ -35,31 +45,31 @@ class Controller {
/**
* The authentication object
* @var \Aviat\AnimeClient\API\Kitsu\Auth $auth ;
* @var Auth $auth ;
*/
protected $auth;
/**
* Cache manager
* @var \Psr\Cache\CacheItemPoolInterface
* @var CacheItemPoolInterface
*/
protected $cache;
/**
* The global configuration object
* @var \Aviat\Ion\ConfigInterface $config
* @var ConfigInterface $config
*/
public $config;
/**
* Request object
* @var \Psr\Http\Message\ServerRequestInterface $request
* @var ServerRequestInterface $request
*/
protected $request;
/**
* Response object
* @var \Psr\Http\Message\ResponseInterface $response
* @var ResponseInterface $response
*/
public $response;
@ -71,13 +81,13 @@ class Controller {
/**
* Aura url generator
* @var \Aura\Router\Generator
* @var Generator
*/
protected $url;
/**
* Session segment
* @var \Aura\Session\Segment
* @var Segment
*/
protected $session;
@ -91,8 +101,8 @@ class Controller {
* Controller constructor.
*
* @param ContainerInterface $container
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
*/
public function __construct(ContainerInterface $container)
{
@ -127,8 +137,8 @@ class Controller {
* Set the current url in the session as the target of a future redirect
*
* @param string|NULL $url
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
*/
public function setSessionRedirect(string $url = NULL): void
{
@ -167,8 +177,8 @@ class Controller {
* If one is not set, redirect to default url
*
* @throws InvalidArgumentException
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
public function sessionRedirect(): void
@ -202,8 +212,8 @@ class Controller {
* @param string $template
* @param array $data
* @throws InvalidArgumentException
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return string
*/
protected function loadPartial($view, string $template, array $data = []): string
@ -236,8 +246,8 @@ class Controller {
* @param string $template
* @param array $data
* @throws InvalidArgumentException
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
protected function renderFullPage($view, string $template, array $data): void
@ -266,8 +276,8 @@ class Controller {
* @param string $title
* @param string $message
* @throws InvalidArgumentException
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
public function notFound(
@ -289,8 +299,8 @@ class Controller {
* @param string $message
* @param string $long_message
* @throws InvalidArgumentException
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
public function errorPage(int $httpCode, string $title, string $message, string $long_message = ''): void
@ -342,7 +352,7 @@ class Controller {
/**
* Helper for consistent page titles
*
* @param string[] $parts Title segments
* @param string ...$parts Title segments
* @return string
*/
public function formatTitle(string ...$parts) : string
@ -357,8 +367,8 @@ class Controller {
* @param string $type
* @param string $message
* @throws InvalidArgumentException
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return string
*/
protected function showMessage($view, string $type, string $message): string
@ -377,8 +387,8 @@ class Controller {
* @param HtmlView|null $view
* @param int $code
* @throws InvalidArgumentException
* @throws \Aviat\Ion\Di\Exception\ContainerException
* @throws \Aviat\Ion\Di\Exception\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
protected function outputHTML(string $template, array $data = [], $view = NULL, int $code = 200): void

View File

@ -16,12 +16,15 @@
namespace Aviat\AnimeClient\Controller;
use Aura\Router\Exception\RouteNotFound;
use Aviat\AnimeClient\Controller as BaseController;
use Aviat\AnimeClient\API\Kitsu\Transformer\AnimeListTransformer;
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Kitsu as KitsuWatchingStatus;
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
use Aviat\AnimeClient\Types\FormItem;
use Aviat\Ion\Di\ContainerInterface;
use Aviat\Ion\Di\Exception\ContainerException;
use Aviat\Ion\Di\Exception\NotFoundException;
use Aviat\Ion\Json;
/**
@ -39,8 +42,8 @@ final class Anime extends BaseController {
* Constructor
*
* @param ContainerInterface $container
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
*/
public function __construct(ContainerInterface $container)
{
@ -60,8 +63,8 @@ final class Anime extends BaseController {
*
* @param string|int $type - The section of the list
* @param string $view - List or cover view
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @throws \InvalidArgumentException
* @return void
*/
@ -104,9 +107,9 @@ final class Anime extends BaseController {
/**
* Form to add an anime
*
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws \Aura\Router\Exception\RouteNotFound
* @throws ContainerException
* @throws NotFoundException
* @throws RouteNotFound
* @throws \InvalidArgumentException
* @return void
*/
@ -128,8 +131,8 @@ final class Anime extends BaseController {
/**
* Add an anime to the list
*
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
public function add(): void
@ -204,8 +207,8 @@ final class Anime extends BaseController {
/**
* Update an anime item via a form submission
*
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @return void
*/
public function formUpdate(): void
@ -292,8 +295,8 @@ final class Anime extends BaseController {
* View details of an anime
*
* @param string $animeId
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @throws \InvalidArgumentException
* @return void
*/

View File

@ -16,12 +16,16 @@
namespace Aviat\AnimeClient\Controller;
use Aura\Router\Exception\RouteNotFound;
use Aviat\AnimeClient\Controller as BaseController;
use Aviat\AnimeClient\Model\{
Anime as AnimeModel,
AnimeCollection as AnimeCollectionModel
};
use Aviat\Ion\Di\ContainerInterface;
use Aviat\Ion\Di\Exception\ContainerException;
use Aviat\Ion\Di\Exception\NotFoundException;
use Aviat\Ion\Exception\DoubleRenderException;
/**
* Controller for Anime collection pages
@ -44,8 +48,8 @@ final class AnimeCollection extends BaseController {
* Constructor
*
* @param ContainerInterface $container
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
*/
public function __construct(ContainerInterface $container)
{
@ -69,7 +73,7 @@ final class AnimeCollection extends BaseController {
/**
* Search for anime
*
* @throws \Aviat\Ion\Exception\DoubleRenderException
* @throws DoubleRenderException
* @return void
*/
public function search(): void
@ -83,8 +87,8 @@ final class AnimeCollection extends BaseController {
* Show the anime collection page
*
* @param string $view
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @throws \InvalidArgumentException
* @return void
*/
@ -108,9 +112,9 @@ final class AnimeCollection extends BaseController {
* Show the anime collection add/edit form
*
* @param integer|null $id
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws \Aura\Router\Exception\RouteNotFound
* @throws ContainerException
* @throws NotFoundException
* @throws RouteNotFound
* @throws \InvalidArgumentException
* @return void
*/
@ -138,8 +142,8 @@ final class AnimeCollection extends BaseController {
/**
* Update a collection item
*
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @throws \InvalidArgumentException
* @return void
*/
@ -173,8 +177,8 @@ final class AnimeCollection extends BaseController {
/**
* Add a collection item
*
* @throws \Aviat\Ion\Di\ContainerException
* @throws \Aviat\Ion\Di\NotFoundException
* @throws ContainerException
* @throws NotFoundException
* @throws \InvalidArgumentException
* @return void
*/

View File

@ -19,7 +19,7 @@ namespace Aviat\AnimeClient\Model;
/**
* Base model for api interaction
*/
class API {
abstract class API {
/**
* Sort the list entries by their title
*

View File

@ -16,6 +16,8 @@
namespace Aviat\AnimeClient\Model;
use Aviat\AnimeClient\API\Anilist\Model as AnilistModel;
use Aviat\AnimeClient\API\Kitsu\Model as KitsuModel;
use Aviat\AnimeClient\API\ParallelAPIRequest;
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
use Aviat\AnimeClient\Types\{
@ -41,14 +43,14 @@ class Anime extends API {
/**
* Model for making requests to Anilist API
*
* @var \Aviat\AnimeClient\API\Anilist\Model
* @var AnilistModel
*/
protected $anilistModel;
/**
* Model for making requests to Kitsu API
*
* @var \Aviat\AnimeClient\API\Kitsu\Model
* @var KitsuModel
*/
protected $kitsuModel;

View File

@ -16,25 +16,94 @@
namespace Aviat\AnimeClient\Types;
use Aviat\AnimeClient\API\Kitsu\Enum\AnimeAiringStatus;
/**
* Type representing an anime within a watch list
*/
class Anime extends AbstractType {
/**
* @var string
*/
public $age_rating;
/**
* @var string
*/
public $age_rating_guide;
/**
* @var string
*/
public $cover_image;
/**
* @var string|number
*/
public $episode_count;
/**
* @var string|number
*/
public $episode_length;
/**
* @var array
*/
public $genres;
/**
* @var string
*/
public $id;
/**
* @var array
*/
public $included;
/**
* @var string
*/
public $show_type;
/**
* @var string
*/
public $slug;
/**
* @var AnimeAiringStatus::NOT_YET_AIRED | AnimeAiringStatus::AIRING | AnimeAiringStatus::FINISHED_AIRING
*/
public $status;
/**
* @var array
*/
public $streaming_links;
/**
* @var string
*/
public $synopsis;
/**
* @var string
*/
public $title;
/**
* @var array
*/
public $titles;
/**
* @var string
*/
public $trailer_id;
/**
* @var string
*/
public $url;
}

View File

@ -17,35 +17,147 @@
namespace Aviat\AnimeClient\Types;
class Config extends AbstractType {
// ------------------------------------------------------------------------
// Config files/namespaces
// ------------------------------------------------------------------------
/**
* @var Config\Anilist
*/
public $anilist;
/**
* @var Config\Cache
*/
public $cache;
/**
* @var Config\Database
*/
public $database;
// ------------------------------------------------------------------------
// Settings in config.toml
// ------------------------------------------------------------------------
/**
* @var string
*/
public $asset_path; // Path to public folder for urls
/**
* @deprecated Use 'theme' instead
* @var bool
*/
public $dark_theme; /* Deprecated */
/**
* Default Anime list status page, values are listed in
* Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Title
*
* @var string
*/
public $default_anime_list_path;
/**
* The list to redirect to from the root url
*
* @var 'anime' | 'manga'
*/
public $default_list;
/**
* Default Manga list status page, values are listed in
* Aviat\AnimeClient\API\Enum\MangaReadingStatus\Title
*
* @var string
*/
public $default_manga_list_path;
/**
* @var 'cover_view' | 'list_view'
*/
public $default_view_type;
/**
* @var string
*/
public $kitsu_username;
/**
* @var bool
*/
public $secure_urls = TRUE;
/**
* @var bool
*/
public $show_anime_collection;
public $show_manga_collection;
/**
* @var bool
*/
public $show_manga_collection = FALSE;
/**
* CSS theme: light, dark, or auto-switching
*
* @var 'auto' | 'light' | 'dark'
*/
public $theme;
/**
* @var string
*/
public $whose_list;
// ------------------------------------------------------------------------
// Application config
// ------------------------------------------------------------------------
/**
* @var array
*/
public $menus;
/**
* @var array
*/
public $routes;
// ------------------------------------------------------------------------
// Generated config values
// ------------------------------------------------------------------------
/**
* @var string
*/
public $asset_dir; // Path to public folder for local files
/**
* @var string
*/
public $base_config_dir;
/**
* @var string
*/
public $config_dir;
/**
* @var string
*/
public $data_cache_path;
/**
* @var string
*/
public $img_cache_path;
/**
* @var string
*/
public $view_path;
public function setAnilist ($data): void

View File

@ -19,14 +19,38 @@ namespace Aviat\AnimeClient\Types\Config;
use Aviat\AnimeClient\Types\AbstractType;
class Anilist extends AbstractType {
/**
* @var bool
*/
public $enabled = FALSE;
/**
* @var string
*/
public $client_id;
/**
* @var string
*/
public $client_secret;
/**
* @var string
*/
public $access_token;
/**
* @var string
*/
public $access_token_expires;
/**
* @var string
*/
public $refresh_token;
/**
* @var string
*/
public $username;
}

View File

@ -19,8 +19,19 @@ namespace Aviat\AnimeClient\Types\Config;
use Aviat\AnimeClient\Types\AbstractType;
class Cache extends AbstractType {
/**
* @var string
*/
public $driver;
/**
* @var array
*/
public $connection = [];
/**
* @var array
*/
public $options = [];
/* public function setConnection($data): void

View File

@ -19,11 +19,38 @@ namespace Aviat\AnimeClient\Types\Config;
use Aviat\AnimeClient\Types\AbstractType;
class Database extends AbstractType {
/**
* @var string
*/
public $type;
/**
* @var string
*/
public $host;
/**
* @var string
*/
public $user;
/**
* @var string
*/
public $pass;
/**
* @var string|number
*/
public $port;
/**
* @var string
*/
public $database;
/**
* @var string
*/
public $file;
}

View File

@ -20,7 +20,6 @@ use const Aviat\AnimeClient\SRC_DIR;
use function Aviat\Ion\_dir;
use Aura\Web\WebFactory;
use Aviat\Ion\Json;
use PHPUnit\Framework\TestCase;
use Spatie\Snapshots\MatchesSnapshots;
@ -39,7 +38,6 @@ use Zend\Diactoros\{
class AnimeClientTestCase extends TestCase {
use MatchesSnapshots;
// Test directory constants
const ROOT_DIR = ROOT_DIR;
const SRC_DIR = SRC_DIR;