Fix merge conflict
This commit is contained in:
commit
83bb85615a
@ -28,14 +28,15 @@ use Aviat\AnimeClient\Model;
|
|||||||
use Aviat\Banker\Pool;
|
use Aviat\Banker\Pool;
|
||||||
use Aviat\Ion\Config;
|
use Aviat\Ion\Config;
|
||||||
use Aviat\Ion\Di\Container;
|
use Aviat\Ion\Di\Container;
|
||||||
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
use Laminas\Diactoros\{Response, ServerRequestFactory};
|
||||||
use Monolog\Handler\RotatingFileHandler;
|
use Monolog\Handler\RotatingFileHandler;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Zend\Diactoros\{Response, ServerRequestFactory};
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Setup DI container
|
// Setup DI container
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
return static function ($configArray = []) {
|
return static function (array $configArray = []): Container {
|
||||||
$container = new Container();
|
$container = new Container();
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@ -60,26 +61,20 @@ return static function ($configArray = []) {
|
|||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
// Create Config Object
|
// Create Config Object
|
||||||
$container->set('config', static function() use ($configArray) {
|
$container->set('config', fn () => new Config($configArray));
|
||||||
return new Config($configArray);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create Cache Object
|
// Create Cache Object
|
||||||
$container->set('cache', static function($container): Pool {
|
$container->set('cache', static function(ContainerInterface $container): Pool {
|
||||||
$logger = $container->getLogger();
|
$logger = $container->getLogger();
|
||||||
$config = $container->get('config')->get('cache');
|
$config = $container->get('config')->get('cache');
|
||||||
return new Pool($config, $logger);
|
return new Pool($config, $logger);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create List Cache
|
|
||||||
|
|
||||||
// Create Aura Router Object
|
// Create Aura Router Object
|
||||||
$container->set('aura-router', static function() {
|
$container->set('aura-router', fn() => new RouterContainer);
|
||||||
return new RouterContainer;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create Html helper Object
|
// Create Html helper Object
|
||||||
$container->set('html-helper', static function($container) {
|
$container->set('html-helper', static function(ContainerInterface $container) {
|
||||||
$htmlHelper = (new HelperLocatorFactory)->newInstance();
|
$htmlHelper = (new HelperLocatorFactory)->newInstance();
|
||||||
$htmlHelper->set('menu', static function() use ($container) {
|
$htmlHelper->set('menu', static function() use ($container) {
|
||||||
$menuHelper = new Helper\Menu();
|
$menuHelper = new Helper\Menu();
|
||||||
@ -101,31 +96,23 @@ return static function ($configArray = []) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create Request/Response Objects
|
// Create Request/Response Objects
|
||||||
$container->set('request', static function() {
|
$container->set('request', fn () => ServerRequestFactory::fromGlobals(
|
||||||
return ServerRequestFactory::fromGlobals(
|
$_SERVER,
|
||||||
$_SERVER,
|
$_GET,
|
||||||
$_GET,
|
$_POST,
|
||||||
$_POST,
|
$_COOKIE,
|
||||||
$_COOKIE,
|
$_FILES
|
||||||
$_FILES
|
));
|
||||||
);
|
$container->set('response', fn () => new Response);
|
||||||
});
|
|
||||||
$container->set('response', static function() {
|
|
||||||
return new Response;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create session Object
|
// Create session Object
|
||||||
$container->set('session', static function() {
|
$container->set('session', fn () => (new SessionFactory())->newInstance($_COOKIE));
|
||||||
return (new SessionFactory())->newInstance($_COOKIE);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Miscellaneous helper methods
|
// Miscellaneous helper methods
|
||||||
$container->set('util', static function($container): Util {
|
$container->set('util', fn ($container) => new Util($container));
|
||||||
return new Util($container);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
$container->set('kitsu-model', static function($container): Kitsu\Model {
|
$container->set('kitsu-model', static function(ContainerInterface $container): Kitsu\Model {
|
||||||
$requestBuilder = new KitsuRequestBuilder();
|
$requestBuilder = new KitsuRequestBuilder();
|
||||||
$requestBuilder->setLogger($container->getLogger('kitsu-request'));
|
$requestBuilder->setLogger($container->getLogger('kitsu-request'));
|
||||||
|
|
||||||
@ -141,7 +128,7 @@ return static function ($configArray = []) {
|
|||||||
$model->setCache($cache);
|
$model->setCache($cache);
|
||||||
return $model;
|
return $model;
|
||||||
});
|
});
|
||||||
$container->set('anilist-model', static function($container): Anilist\Model {
|
$container->set('anilist-model', static function(ContainerInterface $container): Anilist\Model {
|
||||||
$requestBuilder = new Anilist\AnilistRequestBuilder();
|
$requestBuilder = new Anilist\AnilistRequestBuilder();
|
||||||
$requestBuilder->setLogger($container->getLogger('anilist-request'));
|
$requestBuilder->setLogger($container->getLogger('anilist-request'));
|
||||||
|
|
||||||
@ -155,39 +142,24 @@ return static function ($configArray = []) {
|
|||||||
|
|
||||||
return $model;
|
return $model;
|
||||||
});
|
});
|
||||||
|
$container->set('anime-model', fn ($container) => new Model\Anime($container));
|
||||||
$container->set('anime-model', static function($container) {
|
$container->set('manga-model', fn ($container) => new Model\Manga($container));
|
||||||
return new Model\Anime($container);
|
$container->set('anime-collection-model', fn ($container) => new Model\AnimeCollection($container));
|
||||||
});
|
$container->set('manga-collection-model', fn ($container) => new Model\MangaCollection($container));
|
||||||
$container->set('manga-model', static function($container) {
|
|
||||||
return new Model\Manga($container);
|
|
||||||
});
|
|
||||||
$container->set('anime-collection-model', static function($container) {
|
|
||||||
return new Model\AnimeCollection($container);
|
|
||||||
});
|
|
||||||
$container->set('manga-collection-model', static function($container) {
|
|
||||||
return new Model\MangaCollection($container);
|
|
||||||
});
|
|
||||||
$container->set('settings-model', static function($container) {
|
$container->set('settings-model', static function($container) {
|
||||||
$model = new Model\Settings($container->get('config'));
|
$model = new Model\Settings($container->get('config'));
|
||||||
$model->setContainer($container);
|
$model->setContainer($container);
|
||||||
return $model;
|
return $model;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Miscellaneous Classes
|
// Miscellaneous Classes
|
||||||
$container->set('auth', static function($container) {
|
$container->set('auth', fn ($container) => new Kitsu\Auth($container));
|
||||||
return new Kitsu\Auth($container);
|
$container->set('url-generator', fn ($container) => new UrlGenerator($container));
|
||||||
});
|
|
||||||
$container->set('url-generator', static function($container) {
|
|
||||||
return new UrlGenerator($container);
|
|
||||||
});
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Dispatcher
|
// Dispatcher
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
$container->set('dispatcher', static function($container) {
|
$container->set('dispatcher', fn ($container) => new Dispatcher($container));
|
||||||
return new Dispatcher($container);
|
|
||||||
});
|
|
||||||
|
|
||||||
return $container;
|
return $container;
|
||||||
};
|
};
|
||||||
|
@ -75,20 +75,20 @@
|
|||||||
<?php foreach($item['anime']['streaming_links'] as $link): ?>
|
<?php foreach($item['anime']['streaming_links'] as $link): ?>
|
||||||
<?php if ($link['meta']['link'] !== FALSE): ?>
|
<?php if ($link['meta']['link'] !== FALSE): ?>
|
||||||
<a href="<?= $link['link'] ?>" title="Stream '<?= $item['anime']['title'] ?>' on <?= $link['meta']['name'] ?>">
|
<a href="<?= $link['link'] ?>" title="Stream '<?= $item['anime']['title'] ?>' on <?= $link['meta']['name'] ?>">
|
||||||
<?= $helper->picture("images/{$link['meta']['image']}", 'svg', [
|
<?= $helper->img("/public/images/{$link['meta']['image']}", [
|
||||||
'class' => 'streaming-logo',
|
'class' => 'streaming-logo',
|
||||||
'width' => 50,
|
'width' => 50,
|
||||||
'height' => 50,
|
'height' => 50,
|
||||||
'alt' => "{$link['meta']['name']} logo",
|
'alt' => "{$link['meta']['name']} logo",
|
||||||
]); ?>
|
]) ?>
|
||||||
</a>
|
</a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?= $helper->picture("images/{$link['meta']['image']}", 'svg', [
|
<?= $helper->img("/public/images/{$link['meta']['image']}", [
|
||||||
'class' => 'streaming-logo',
|
'class' => 'streaming-logo',
|
||||||
'width' => 50,
|
'width' => 50,
|
||||||
'height' => 50,
|
'height' => 50,
|
||||||
'alt' => "{$link['meta']['name']} logo",
|
'alt' => "{$link['meta']['name']} logo",
|
||||||
]); ?>
|
]) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</td>
|
</td>
|
||||||
|
@ -68,7 +68,7 @@ abstract class APIRequestBuilder {
|
|||||||
* The current request
|
* The current request
|
||||||
* @var Request
|
* @var Request
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected Request $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do a basic minimal GET request
|
* Do a basic minimal GET request
|
||||||
@ -78,8 +78,10 @@ abstract class APIRequestBuilder {
|
|||||||
*/
|
*/
|
||||||
public static function simpleRequest(string $uri): Request
|
public static function simpleRequest(string $uri): Request
|
||||||
{
|
{
|
||||||
return (new Request($uri))
|
$request = (new Request($uri));
|
||||||
->setHeader('User-Agent', USER_AGENT);
|
$request->setHeader('User-Agent', USER_AGENT);
|
||||||
|
|
||||||
|
return $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,20 +38,20 @@ trait AnilistTrait {
|
|||||||
* The request builder for the Anilist API
|
* The request builder for the Anilist API
|
||||||
* @var AnilistRequestBuilder
|
* @var AnilistRequestBuilder
|
||||||
*/
|
*/
|
||||||
protected $requestBuilder;
|
protected AnilistRequestBuilder $requestBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base url for api requests
|
* The base url for api requests
|
||||||
* @var string $base_url
|
* @var string $base_url
|
||||||
*/
|
*/
|
||||||
protected $baseUrl = Anilist::BASE_URL;
|
protected string $baseUrl = Anilist::BASE_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP headers to send with every request
|
* HTTP headers to send with every request
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $defaultHeaders = [
|
protected array $defaultHeaders = [
|
||||||
'Accept' => 'application/json',
|
'Accept' => 'application/json',
|
||||||
'Accept-Encoding' => 'gzip',
|
'Accept-Encoding' => 'gzip',
|
||||||
'Content-type' => 'application/json',
|
'Content-type' => 'application/json',
|
||||||
|
@ -39,7 +39,7 @@ final class Model
|
|||||||
/**
|
/**
|
||||||
* @var ListItem
|
* @var ListItem
|
||||||
*/
|
*/
|
||||||
private $listItem;
|
private ListItem $listItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -26,7 +26,7 @@ trait CacheTrait {
|
|||||||
/**
|
/**
|
||||||
* @var Pool
|
* @var Pool
|
||||||
*/
|
*/
|
||||||
protected $cache;
|
protected Pool $cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inject the cache object
|
* Inject the cache object
|
||||||
|
@ -42,14 +42,14 @@ final class Auth {
|
|||||||
*
|
*
|
||||||
* @var Model
|
* @var Model
|
||||||
*/
|
*/
|
||||||
private $model;
|
private Model $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session object
|
* Session object
|
||||||
*
|
*
|
||||||
* @var Segment
|
* @var Segment
|
||||||
*/
|
*/
|
||||||
private $segment;
|
private Segment $segment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -38,7 +38,7 @@ trait KitsuTrait {
|
|||||||
* The request builder for the Kitsu API
|
* The request builder for the Kitsu API
|
||||||
* @var KitsuRequestBuilder
|
* @var KitsuRequestBuilder
|
||||||
*/
|
*/
|
||||||
protected $requestBuilder;
|
protected KitsuRequestBuilder $requestBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the request builder object
|
* Set the request builder object
|
||||||
|
@ -65,27 +65,27 @@ final class Model {
|
|||||||
*
|
*
|
||||||
* @var AnimeListTransformer
|
* @var AnimeListTransformer
|
||||||
*/
|
*/
|
||||||
private $animeListTransformer;
|
private AnimeListTransformer $animeListTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var AnimeTransformer
|
* @var AnimeTransformer
|
||||||
*/
|
*/
|
||||||
private $animeTransformer;
|
private AnimeTransformer $animeTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ListItem
|
* @var ListItem
|
||||||
*/
|
*/
|
||||||
private $listItem;
|
private ListItem $listItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var MangaTransformer
|
* @var MangaTransformer
|
||||||
*/
|
*/
|
||||||
private $mangaTransformer;
|
private MangaTransformer $mangaTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var MangaListTransformer
|
* @var MangaListTransformer
|
||||||
*/
|
*/
|
||||||
private $mangaListTransformer;
|
private MangaListTransformer $mangaListTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -33,7 +33,7 @@ final class ParallelAPIRequest {
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $requests = [];
|
private array $requests = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a request
|
* Add a request
|
||||||
|
@ -29,9 +29,9 @@ use Aviat\Ion\Config;
|
|||||||
use Aviat\Ion\Di\{Container, ContainerAware};
|
use Aviat\Ion\Di\{Container, ContainerAware};
|
||||||
use ConsoleKit\{Command, ConsoleException};
|
use ConsoleKit\{Command, ConsoleException};
|
||||||
use ConsoleKit\Widgets\Box;
|
use ConsoleKit\Widgets\Box;
|
||||||
|
use Laminas\Diactoros\{Response, ServerRequestFactory};
|
||||||
use Monolog\Handler\RotatingFileHandler;
|
use Monolog\Handler\RotatingFileHandler;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use Zend\Diactoros\{Response, ServerRequestFactory};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for console command setup
|
* Base class for console command setup
|
||||||
|
@ -44,13 +44,13 @@ final class SyncLists extends BaseCommand {
|
|||||||
* Model for making requests to Anilist API
|
* Model for making requests to Anilist API
|
||||||
* @var AnilistModel
|
* @var AnilistModel
|
||||||
*/
|
*/
|
||||||
protected $anilistModel;
|
protected AnilistModel $anilistModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for making requests to Kitsu API
|
* Model for making requests to Kitsu API
|
||||||
* @var KitsuModel
|
* @var KitsuModel
|
||||||
*/
|
*/
|
||||||
protected $kitsuModel;
|
protected KitsuModel $kitsuModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the Kitsu <=> Anilist sync script
|
* Run the Kitsu <=> Anilist sync script
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
namespace Aviat\AnimeClient\Command;
|
namespace Aviat\AnimeClient\Command;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\JsonAPI;
|
use Aviat\AnimeClient\API\JsonAPI;
|
||||||
use Aviat\AnimeClient\API\Kitsu\Model;
|
use Aviat\AnimeClient\API\Kitsu\Model as KitsuModel;
|
||||||
use Aviat\AnimeClient\Controller\Images;
|
use Aviat\AnimeClient\Controller\Images;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,14 +27,14 @@ use Aviat\AnimeClient\Controller\Images;
|
|||||||
final class UpdateThumbnails extends ClearThumbnails {
|
final class UpdateThumbnails extends ClearThumbnails {
|
||||||
/**
|
/**
|
||||||
* Model for making requests to Kitsu API
|
* Model for making requests to Kitsu API
|
||||||
* @var Model
|
* @var KitsuModel
|
||||||
*/
|
*/
|
||||||
protected $kitsuModel;
|
protected KitsuModel $kitsuModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default controller, which has the method to cache the images
|
* The default controller, which has the method to cache the images
|
||||||
*/
|
*/
|
||||||
protected $controller;
|
protected Images $controller;
|
||||||
|
|
||||||
public function execute(array $args, array $options = []): void
|
public function execute(array $args, array $options = []): void
|
||||||
{
|
{
|
||||||
|
@ -47,55 +47,55 @@ class Controller {
|
|||||||
* The authentication object
|
* The authentication object
|
||||||
* @var Auth $auth ;
|
* @var Auth $auth ;
|
||||||
*/
|
*/
|
||||||
protected $auth;
|
protected Auth $auth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache manager
|
* Cache manager
|
||||||
* @var CacheItemPoolInterface
|
* @var CacheItemPoolInterface
|
||||||
*/
|
*/
|
||||||
protected $cache;
|
protected CacheItemPoolInterface $cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The global configuration object
|
* The global configuration object
|
||||||
* @var ConfigInterface $config
|
* @var ConfigInterface $config
|
||||||
*/
|
*/
|
||||||
public $config;
|
public ConfigInterface $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request object
|
* Request object
|
||||||
* @var ServerRequestInterface $request
|
* @var ServerRequestInterface $request
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected ServerRequestInterface $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response object
|
* Response object
|
||||||
* @var ResponseInterface $response
|
* @var ResponseInterface $response
|
||||||
*/
|
*/
|
||||||
public $response;
|
public ResponseInterface $response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Url generation class
|
* Url generation class
|
||||||
* @var UrlGenerator
|
* @var UrlGenerator
|
||||||
*/
|
*/
|
||||||
protected $urlGenerator;
|
protected UrlGenerator $urlGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aura url generator
|
* Aura url generator
|
||||||
* @var Generator
|
* @var Generator
|
||||||
*/
|
*/
|
||||||
protected $url;
|
protected Generator $url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session segment
|
* Session segment
|
||||||
* @var Segment
|
* @var Segment
|
||||||
*/
|
*/
|
||||||
protected $session;
|
protected Segment $session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common data to be sent to views
|
* Common data to be sent to views
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $baseData = [];
|
protected array $baseData = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller constructor.
|
* Controller constructor.
|
||||||
|
@ -21,6 +21,7 @@ use Aviat\AnimeClient\Controller as BaseController;
|
|||||||
use Aviat\AnimeClient\API\Kitsu\Transformer\AnimeListTransformer;
|
use Aviat\AnimeClient\API\Kitsu\Transformer\AnimeListTransformer;
|
||||||
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Kitsu as KitsuWatchingStatus;
|
use Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Kitsu as KitsuWatchingStatus;
|
||||||
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
||||||
|
use Aviat\AnimeClient\Model\Anime as AnimeModel;
|
||||||
use Aviat\AnimeClient\Types\FormItem;
|
use Aviat\AnimeClient\Types\FormItem;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Di\Exception\ContainerException;
|
use Aviat\Ion\Di\Exception\ContainerException;
|
||||||
@ -37,9 +38,9 @@ final class Anime extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The anime list model
|
* The anime list model
|
||||||
* @var \Aviat\AnimeClient\Model\Anime $model
|
* @var AnimeModel $model
|
||||||
*/
|
*/
|
||||||
protected $model;
|
protected AnimeModel $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -38,13 +38,13 @@ final class AnimeCollection extends BaseController {
|
|||||||
* The anime collection model
|
* The anime collection model
|
||||||
* @var AnimeCollectionModel $animeCollectionModel
|
* @var AnimeCollectionModel $animeCollectionModel
|
||||||
*/
|
*/
|
||||||
private $animeCollectionModel;
|
private AnimeCollectionModel $animeCollectionModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The anime API model
|
* The anime API model
|
||||||
* @var AnimeModel $animeModel
|
* @var AnimeModel $animeModel
|
||||||
*/
|
*/
|
||||||
private $animeModel;
|
private AnimeModel $animeModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -32,7 +32,7 @@ class Character extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* @var Model
|
* @var Model
|
||||||
*/
|
*/
|
||||||
private $model;
|
private Model $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Character constructor.
|
* Character constructor.
|
||||||
|
@ -38,7 +38,7 @@ final class Manga extends Controller {
|
|||||||
* The manga model
|
* The manga model
|
||||||
* @var MangaModel $model
|
* @var MangaModel $model
|
||||||
*/
|
*/
|
||||||
protected $model;
|
protected MangaModel $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -32,7 +32,7 @@ final class People extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* @var Model
|
* @var Model
|
||||||
*/
|
*/
|
||||||
private $model;
|
private Model $model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* People constructor.
|
* People constructor.
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
namespace Aviat\AnimeClient\Controller;
|
namespace Aviat\AnimeClient\Controller;
|
||||||
|
|
||||||
use Aura\Router\Exception\RouteNotFound;
|
use Aura\Router\Exception\RouteNotFound;
|
||||||
use Aviat\AnimeClient\API\Anilist\Model;
|
use Aviat\AnimeClient\API\Anilist\Model as AnilistModel;
|
||||||
use Aviat\AnimeClient\Controller as BaseController;
|
use Aviat\AnimeClient\Controller as BaseController;
|
||||||
|
use Aviat\AnimeClient\Model\Settings as SettingsModel;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Di\Exception\ContainerException;
|
use Aviat\Ion\Di\Exception\ContainerException;
|
||||||
use Aviat\Ion\Di\Exception\NotFoundException;
|
use Aviat\Ion\Di\Exception\NotFoundException;
|
||||||
@ -29,14 +30,14 @@ use Aviat\Ion\Di\Exception\NotFoundException;
|
|||||||
final class Settings extends BaseController {
|
final class Settings extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Model
|
* @var AnilistModel
|
||||||
*/
|
*/
|
||||||
private $anilistModel;
|
private AnilistModel $anilistModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Aviat\AnimeClient\Model\Settings
|
* @var SettingsModel
|
||||||
*/
|
*/
|
||||||
private $settingsModel;
|
private SettingsModel $settingsModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings constructor.
|
* Settings constructor.
|
||||||
|
@ -32,7 +32,7 @@ final class User extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* @var Model
|
* @var Model
|
||||||
*/
|
*/
|
||||||
private $kitsuModel;
|
private Model $kitsuModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User constructor.
|
* User constructor.
|
||||||
|
@ -18,7 +18,7 @@ namespace Aviat\AnimeClient;
|
|||||||
|
|
||||||
use function Aviat\Ion\_dir;
|
use function Aviat\Ion\_dir;
|
||||||
|
|
||||||
use Aura\Router\{Matcher, Route, Rule};
|
use Aura\Router\{Map, Matcher, Route, Rule};
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\FailedResponseException;
|
use Aviat\AnimeClient\API\FailedResponseException;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
@ -34,9 +34,9 @@ final class Dispatcher extends RoutingBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The route-matching object
|
* The route-matching object
|
||||||
* @var object $router
|
* @var Map $router
|
||||||
*/
|
*/
|
||||||
protected $router;
|
protected Map $router;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The route matcher
|
* The route matcher
|
||||||
|
@ -30,7 +30,7 @@ final class FormGenerator {
|
|||||||
*
|
*
|
||||||
* @var HelperLocator
|
* @var HelperLocator
|
||||||
*/
|
*/
|
||||||
private $helper;
|
private HelperLocator $helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FormGenerator constructor.
|
* FormGenerator constructor.
|
||||||
@ -93,6 +93,9 @@ final class FormGenerator {
|
|||||||
$params['type'] = 'select';
|
$params['type'] = 'select';
|
||||||
$params['options'] = array_flip($form['options']);
|
$params['options'] = array_flip($form['options']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (['readonly', 'disabled'] as $key)
|
foreach (['readonly', 'disabled'] as $key)
|
||||||
|
@ -34,14 +34,14 @@ final class MenuGenerator extends UrlGenerator {
|
|||||||
*
|
*
|
||||||
* @var HelperLocator
|
* @var HelperLocator
|
||||||
*/
|
*/
|
||||||
protected $helper;
|
protected HelperLocator $helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request object
|
* Request object
|
||||||
*
|
*
|
||||||
* @var RequestInterface
|
* @var RequestInterface
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected RequestInterface $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MenuGenerator constructor.
|
* MenuGenerator constructor.
|
||||||
|
@ -40,21 +40,21 @@ class Anime extends API {
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $anilistEnabled;
|
protected bool $anilistEnabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for making requests to Anilist API
|
* Model for making requests to Anilist API
|
||||||
*
|
*
|
||||||
* @var AnilistModel
|
* @var AnilistModel
|
||||||
*/
|
*/
|
||||||
protected $anilistModel;
|
protected AnilistModel $anilistModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for making requests to Kitsu API
|
* Model for making requests to Kitsu API
|
||||||
*
|
*
|
||||||
* @var KitsuModel
|
* @var KitsuModel
|
||||||
*/
|
*/
|
||||||
protected $kitsuModel;
|
protected KitsuModel $kitsuModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Anime constructor.
|
* Anime constructor.
|
||||||
|
@ -29,7 +29,7 @@ final class AnimeCollection extends Collection {
|
|||||||
* Anime API Model
|
* Anime API Model
|
||||||
* @var Anime $animeModel
|
* @var Anime $animeModel
|
||||||
*/
|
*/
|
||||||
protected $animeModel;
|
protected Anime $animeModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the collection model
|
* Create the collection model
|
||||||
|
@ -31,13 +31,13 @@ class Collection extends DB {
|
|||||||
* The query builder object
|
* The query builder object
|
||||||
* @var Query_Builder_Interface
|
* @var Query_Builder_Interface
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected Query_Builder_Interface $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the database is valid for querying
|
* Whether the database is valid for querying
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $validDatabase = FALSE;
|
protected bool $validDatabase = FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new collection object
|
* Create a new collection object
|
||||||
|
@ -26,6 +26,7 @@ use Aviat\AnimeClient\Types\{
|
|||||||
MangaListItem,
|
MangaListItem,
|
||||||
MangaPage
|
MangaPage
|
||||||
};
|
};
|
||||||
|
use Aviat\AnimeClient\API\{Anilist, Kitsu};
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Json;
|
use Aviat\Ion\Json;
|
||||||
|
|
||||||
@ -40,19 +41,19 @@ class Manga extends API {
|
|||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $anilistEnabled;
|
protected bool $anilistEnabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for making requests to the Anilist API
|
* Model for making requests to the Anilist API
|
||||||
* @var \Aviat\AnimeClient\API\Anilist\Model
|
* @var Anilist\Model
|
||||||
*/
|
*/
|
||||||
protected $anilistModel;
|
protected Anilist\Model $anilistModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for making requests to Kitsu API
|
* Model for making requests to Kitsu API
|
||||||
* @var \Aviat\AnimeClient\API\Kitsu\Model
|
* @var Kitsu\Model
|
||||||
*/
|
*/
|
||||||
protected $kitsuModel;
|
protected Kitsu\Model $kitsuModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\Config;
|
use Aviat\Ion\ConfigInterface;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Di\Exception\ContainerException;
|
use Aviat\Ion\Di\Exception\ContainerException;
|
||||||
use Aviat\Ion\Di\Exception\NotFoundException;
|
use Aviat\Ion\Di\Exception\NotFoundException;
|
||||||
use Aviat\Ion\Exception\ConfigException;
|
use Aviat\Ion\Exception\ConfigException;
|
||||||
use Aviat\Ion\Type\StringType;
|
use Aviat\Ion\Type\StringType;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\RequestInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base for routing/url classes
|
* Base for routing/url classes
|
||||||
@ -37,15 +37,15 @@ class RoutingBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Config Object
|
* Config Object
|
||||||
* @var Config
|
* @var ConfigInterface
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected ConfigInterface $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class wrapper for input superglobals
|
* Class wrapper for input superglobals
|
||||||
* @var ServerRequestInterface
|
* @var RequestInterface
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected RequestInterface $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -30,7 +30,7 @@ class UrlGenerator extends RoutingBase {
|
|||||||
* The current HTTP host
|
* The current HTTP host
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $host;
|
protected string $host;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -49,7 +49,7 @@ class UrlGenerator extends RoutingBase {
|
|||||||
/**
|
/**
|
||||||
* Get the base url for css/js/images
|
* Get the base url for css/js/images
|
||||||
*
|
*
|
||||||
* @param string ...$args
|
* @param array $args
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function assetUrl(string ...$args): string
|
public function assetUrl(string ...$args): string
|
||||||
|
@ -30,7 +30,7 @@ class Util {
|
|||||||
* Routes that don't require a second navigation level
|
* Routes that don't require a second navigation level
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $formPages = [
|
private static array $formPages = [
|
||||||
'edit',
|
'edit',
|
||||||
'add',
|
'add',
|
||||||
'update',
|
'update',
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
<?php declare(strict_types=1);
|
|
||||||
/**
|
|
||||||
* Hummingbird Anime List Client
|
|
||||||
*
|
|
||||||
* An API client for Kitsu to manage anime and manga watch lists
|
|
||||||
*
|
|
||||||
* PHP version 7.4
|
|
||||||
*
|
|
||||||
* @package HummingbirdAnimeClient
|
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
|
||||||
* @copyright 2015 - 2020 Timothy J. Warren
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
||||||
* @version 5
|
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Aviat\Ion\Model;
|
|
||||||
|
|
||||||
use Aviat\Ion\ConfigInterface;
|
|
||||||
use Aviat\Ion\Model as BaseModel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base model for database interaction
|
|
||||||
*/
|
|
||||||
class DB extends BaseModel {
|
|
||||||
/**
|
|
||||||
* The query builder object
|
|
||||||
* @var object $db
|
|
||||||
*/
|
|
||||||
protected $db;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The config manager
|
|
||||||
* @var ConfigInterface
|
|
||||||
*/
|
|
||||||
protected $config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The database connection information array
|
|
||||||
* @var array $db_config
|
|
||||||
*/
|
|
||||||
protected $db_config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param ConfigInterface $config
|
|
||||||
*/
|
|
||||||
public function __construct(ConfigInterface $config)
|
|
||||||
{
|
|
||||||
$this->config = $config;
|
|
||||||
$this->db_config = (array)$config->get('database');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// End of DB.php
|
|
@ -1,29 +0,0 @@
|
|||||||
<?php declare(strict_types=1);
|
|
||||||
/**
|
|
||||||
* Hummingbird Anime List Client
|
|
||||||
*
|
|
||||||
* An API client for Kitsu to manage anime and manga watch lists
|
|
||||||
*
|
|
||||||
* PHP version 7.4
|
|
||||||
*
|
|
||||||
* @package HummingbirdAnimeClient
|
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
|
||||||
* @copyright 2015 - 2020 Timothy J. Warren
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
||||||
* @version 5
|
|
||||||
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Aviat\Ion\Tests\Model;
|
|
||||||
|
|
||||||
use Aviat\Ion\Model\DB as BaseDBModel;
|
|
||||||
use Aviat\Ion\Tests\IonTestCase;
|
|
||||||
|
|
||||||
class BaseDBModelTest extends IonTestCase {
|
|
||||||
|
|
||||||
public function testBaseDBModelSanity()
|
|
||||||
{
|
|
||||||
$baseDBModel = new BaseDBModel($this->container->get('config'));
|
|
||||||
$this->assertTrue(is_object($baseDBModel));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user