Version 5.1 - All the GraphQL #32
@ -189,7 +189,7 @@ final class Model
|
||||
*/
|
||||
public function deleteItem(FormItem $data, string $type): ?Request
|
||||
{
|
||||
$mediaId = $this->getMediaId((array)$data, $type);
|
||||
$mediaId = $this->getMediaId((array) $data, $type);
|
||||
if ($mediaId === NULL)
|
||||
{
|
||||
return NULL;
|
||||
@ -209,7 +209,7 @@ final class Model
|
||||
*/
|
||||
public function getListIdFromData(FormItem $data, string $type = 'ANIME'): ?string
|
||||
{
|
||||
$mediaId = $this->getMediaId((array)$data, $type);
|
||||
$mediaId = $this->getMediaId((array) $data, $type);
|
||||
if ($mediaId === NULL)
|
||||
{
|
||||
return NULL;
|
||||
@ -244,7 +244,7 @@ final class Model
|
||||
/**
|
||||
* Find the id to update by
|
||||
*/
|
||||
private function getMediaId (array $data, string $type = 'ANIME'): ?string
|
||||
private function getMediaId(array $data, string $type = 'ANIME'): ?string
|
||||
{
|
||||
if (isset($data['anilist_id']))
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ final class Auth
|
||||
/**
|
||||
* Save the new authentication information
|
||||
*/
|
||||
private function storeAuth(array|FALSE $auth): bool
|
||||
private function storeAuth(array|false $auth): bool
|
||||
{
|
||||
if (FALSE !== $auth)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@ use Aviat\AnimeClient\API\{
|
||||
use Aviat\AnimeClient\Enum\MediaType;
|
||||
use Aviat\AnimeClient\Kitsu as K;
|
||||
use Aviat\AnimeClient\Types\{Anime, MangaPage};
|
||||
use Aviat\AnimeClient\Types\{AnimeListItem, MangaListItem};
|
||||
use Aviat\Ion\{
|
||||
Di\ContainerAware,
|
||||
Json
|
||||
|
@ -67,9 +67,6 @@ trait MutationTrait
|
||||
|
||||
/**
|
||||
* Remove a list item
|
||||
*
|
||||
* @param FormItem $data
|
||||
* @return Request
|
||||
*/
|
||||
public function deleteItem(FormItem $data): Request
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ final class ParallelAPIRequest
|
||||
/**
|
||||
* Add a request
|
||||
*/
|
||||
public function addRequest(string|Request $request, string|int|NULL $key = NULL): self
|
||||
public function addRequest(string|Request $request, string|int|null $key = NULL): self
|
||||
{
|
||||
if ($key !== NULL)
|
||||
{
|
||||
|
@ -17,6 +17,7 @@ namespace Aviat\AnimeClient;
|
||||
use Amp\Http\Client\{HttpClient, HttpClientBuilder, Request, Response};
|
||||
|
||||
use Aviat\Ion\{ConfigInterface, ImageBuilder};
|
||||
use PHPUnit\Framework\Attributes\CodeCoverageIgnore;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use Throwable;
|
||||
|
||||
@ -31,9 +32,9 @@ use function Aviat\Ion\_dir;
|
||||
/**
|
||||
* Load configuration options from .toml files
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @param string $path - Path to load config
|
||||
*/
|
||||
#[CodeCoverageIgnore]
|
||||
function loadConfig(string $path): array
|
||||
{
|
||||
$output = [];
|
||||
@ -72,9 +73,8 @@ function loadConfig(string $path): array
|
||||
|
||||
/**
|
||||
* Load config from one specific TOML file
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
#[CodeCoverageIgnore]
|
||||
function loadTomlFile(string $filename): array
|
||||
{
|
||||
return Toml::parseFile($filename);
|
||||
@ -131,19 +131,6 @@ function tomlToArray(string $toml): array
|
||||
//! Misc Functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
if ( ! function_exists('array_is_list'))
|
||||
{
|
||||
/**
|
||||
* Polyfill for PHP 8
|
||||
*
|
||||
* @see https://www.php.net/manual/en/function.array-is-list
|
||||
*/
|
||||
function array_is_list(array $a): bool
|
||||
{
|
||||
return $a === [] || (array_keys($a) === range(0, count($a) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the array sequential, not associative?
|
||||
*/
|
||||
@ -256,9 +243,8 @@ function getLocalImg(string $kitsuUrl, bool $webp = TRUE): string
|
||||
|
||||
/**
|
||||
* Create a transparent placeholder image
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
#[CodeCoverageIgnore]
|
||||
function createPlaceholderImage(string $path, int $width = 200, int $height = 200, string $text = 'Image Unavailable'): bool
|
||||
{
|
||||
$img = ImageBuilder::new($width, $height)
|
||||
@ -303,16 +289,15 @@ function clearCache(CacheInterface $cache): bool
|
||||
|
||||
$cleared = $cache->clear();
|
||||
|
||||
$saved = (empty($userData)) ? TRUE : $cache->setMultiple($userData);
|
||||
$saved = empty($userData) || $cache->setMultiple($userData);
|
||||
|
||||
return $cleared && $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a PHP code template as a string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
#[CodeCoverageIgnore]
|
||||
function renderTemplate(string $path, array $data): string
|
||||
{
|
||||
ob_start();
|
||||
|
@ -44,7 +44,7 @@ abstract class BaseCommand extends Command
|
||||
/**
|
||||
* Echo text in a box
|
||||
*/
|
||||
public function echoBox(string|array $message, string|int|NULL $fgColor = NULL, string|int|NULL $bgColor = NULL): void
|
||||
public function echoBox(string|array $message, string|int|null $fgColor = NULL, string|int|null $bgColor = NULL): void
|
||||
{
|
||||
if (is_array($message))
|
||||
{
|
||||
@ -131,7 +131,7 @@ abstract class BaseCommand extends Command
|
||||
return $this->_di($configArray, $APP_DIR);
|
||||
}
|
||||
|
||||
private function _line(string $message, int|string|NULL $fgColor = NULL, int|string|NULL $bgColor = NULL): void
|
||||
private function _line(string $message, int|string|null $fgColor = NULL, int|string|null $bgColor = NULL): void
|
||||
{
|
||||
if ($fgColor !== NULL)
|
||||
{
|
||||
|
@ -98,21 +98,23 @@ final class SyncLists extends BaseCommand
|
||||
if ( ! $anilistEnabled)
|
||||
{
|
||||
$this->echoErrorBox('Anlist API is not enabled. Can not sync.');
|
||||
return false;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Authentication is required to update Kitsu
|
||||
$isKitsuAuthenticated = $this->container->get('auth')->isAuthenticated();
|
||||
if ( !$isKitsuAuthenticated)
|
||||
if ( ! $isKitsuAuthenticated)
|
||||
{
|
||||
$this->echoErrorBox('Kitsu is not authenticated. Kitsu list can not be updated.');
|
||||
return false;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->anilistModel = $this->container->get('anilist-model');
|
||||
$this->kitsuModel = $this->container->get('kitsu-model');
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,7 +150,7 @@ final class SyncLists extends BaseCommand
|
||||
*/
|
||||
protected function fetch(string $type): array
|
||||
{
|
||||
$this->echo("Fetching $type List Data");
|
||||
$this->echo("Fetching {$type} List Data");
|
||||
$progress = new Widgets\ProgressBar($this->getConsole(), 2, 50, FALSE);
|
||||
|
||||
$anilist = $this->fetchAnilist($type);
|
||||
|
@ -121,13 +121,13 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current url in the session as the target of a future redirect
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws ContainerException
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function setSessionRedirect(?string $url = NULL): void
|
||||
* Set the current url in the session as the target of a future redirect
|
||||
*
|
||||
* @throws ContainerException
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
public function setSessionRedirect(?string $url = NULL): void
|
||||
{
|
||||
$serverParams = $this->request->getServerParams();
|
||||
|
||||
@ -159,14 +159,14 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the url previously set in the session
|
||||
*
|
||||
* If one is not set, redirect to default url
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function sessionRedirect(): void
|
||||
* Redirect to the url previously set in the session
|
||||
*
|
||||
* If one is not set, redirect to default url
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
public function sessionRedirect(): void
|
||||
{
|
||||
$target = $this->session->get('redirect_url') ?? '/';
|
||||
|
||||
@ -175,10 +175,10 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current user is authenticated, else error and exit
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function checkAuth(): void
|
||||
* Check if the current user is authenticated, else error and exit
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
protected function checkAuth(): void
|
||||
{
|
||||
if ( ! $this->auth->isAuthenticated())
|
||||
{
|
||||
@ -191,11 +191,10 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string output of a partial template
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function loadPartial(HtmlView $view, string $template, array $data = []): string
|
||||
* Get the string output of a partial template
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
protected function loadPartial(HtmlView $view, string $template, array $data = []): string
|
||||
{
|
||||
$router = $this->container->get('dispatcher');
|
||||
|
||||
@ -218,11 +217,10 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a template with header and footer
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function renderFullPage(HtmlView $view, string $template, array $data): HtmlView
|
||||
* Render a template with header and footer
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
protected function renderFullPage(HtmlView $view, string $template, array $data): HtmlView
|
||||
{
|
||||
$csp = [
|
||||
"default-src 'self' media.kitsu.io kitsu-production-media.s3.us-west-002.backblazeb2.com",
|
||||
@ -245,12 +243,12 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 404 action
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function notFound(
|
||||
* 404 action
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
public function notFound(
|
||||
string $title = 'Sorry, page not found',
|
||||
string $message = 'Page Not Found'
|
||||
): void {
|
||||
@ -263,12 +261,12 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a generic error page
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function errorPage(int $httpCode, string $title, string $message, string $longMessage = ''): void
|
||||
* Display a generic error page
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
public function errorPage(int $httpCode, string $title, string $message, string $longMessage = ''): void
|
||||
{
|
||||
$this->outputHTML('error', [
|
||||
'title' => $title,
|
||||
@ -278,24 +276,23 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the default controller/url from an empty path
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function redirectToDefaultRoute(): void
|
||||
* Redirect to the default controller/url from an empty path
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
public function redirectToDefaultRoute(): void
|
||||
{
|
||||
$defaultType = $this->config->get('default_list');
|
||||
$this->redirect($this->urlGenerator->defaultUrl($defaultType), 303);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a session flash variable to display a message on
|
||||
* next page load
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setFlashMessage(string $message, string $type = 'info'): void
|
||||
* Set a session flash variable to display a message on
|
||||
* next page load
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
public function setFlashMessage(string $message, string $type = 'info'): void
|
||||
{
|
||||
static $messages;
|
||||
|
||||
@ -323,12 +320,12 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message box to the page
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function showMessage(HtmlView $view, string $type, string $message): string
|
||||
* Add a message box to the page
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
protected function showMessage(HtmlView $view, string $type, string $message): string
|
||||
{
|
||||
return $this->loadPartial($view, 'message', [
|
||||
'message_type' => $type,
|
||||
@ -337,12 +334,12 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a template to HTML, using the provided data
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
protected function outputHTML(string $template, array $data = [], ?HtmlView $view = NULL, int $code = 200): void
|
||||
* Output a template to HTML, using the provided data
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
protected function outputHTML(string $template, array $data = [], ?HtmlView $view = NULL, int $code = 200): void
|
||||
{
|
||||
if (NULL === $view)
|
||||
{
|
||||
@ -354,13 +351,13 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a JSON Response
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @param int $code - the http status code
|
||||
* @throws DoubleRenderException
|
||||
*/
|
||||
protected function outputJSON(mixed $data, int $code): void
|
||||
* Output a JSON Response
|
||||
*
|
||||
* @param int $code - the http status code
|
||||
* @throws DoubleRenderException
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
protected function outputJSON(mixed $data, int $code): void
|
||||
{
|
||||
JsonView::new()
|
||||
->setOutput($data)
|
||||
@ -369,11 +366,10 @@ class Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the selected page
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function redirect(string $url, int $code): void
|
||||
* Redirect to the selected page
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
protected function redirect(string $url, int $code): void
|
||||
{
|
||||
HttpView::new()
|
||||
->redirect($url, $code)
|
||||
|
@ -21,8 +21,7 @@ use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
use Aviat\AnimeClient\Model\Anime as AnimeModel;
|
||||
use Aviat\AnimeClient\Types\FormItem;
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
use Aviat\Ion\Json;
|
||||
|
@ -20,11 +20,9 @@ use Aviat\AnimeClient\Model\{
|
||||
Anime as AnimeModel,
|
||||
AnimeCollection as AnimeCollectionModel
|
||||
};
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
use Aviat\Ion\Json;
|
||||
use Aviat\Ion\Exception\DoubleRenderException;
|
||||
|
||||
use InvalidArgumentException;
|
||||
@ -114,7 +112,6 @@ final class AnimeCollection extends BaseController
|
||||
/**
|
||||
* Show the anime collection add/edit form
|
||||
*
|
||||
* @param int|null $id
|
||||
* @throws ContainerException
|
||||
* @throws InvalidArgumentException
|
||||
* @throws NotFoundException
|
||||
|
@ -18,8 +18,7 @@ use Aviat\AnimeClient\API\Kitsu\Model;
|
||||
use Aviat\AnimeClient\API\Kitsu\Transformer\CharacterTransformer;
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
|
||||
|
@ -14,9 +14,8 @@
|
||||
|
||||
namespace Aviat\AnimeClient\Controller;
|
||||
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\AnimeClient\{Controller as BaseController, Model};
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
|
||||
|
@ -15,8 +15,7 @@
|
||||
namespace Aviat\AnimeClient\Controller;
|
||||
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Throwable;
|
||||
use function Amp\Promise\wait;
|
||||
use function Aviat\AnimeClient\{createPlaceholderImage, getResponse};
|
||||
|
@ -14,21 +14,16 @@
|
||||
|
||||
namespace Aviat\AnimeClient\Controller;
|
||||
|
||||
use Aura\Router\Exception\RouteNotFound;
|
||||
use Aviat\AnimeClient\API\Kitsu\Transformer\MangaListTransformer;
|
||||
use Aviat\AnimeClient\API\Mapping\MangaReadingStatus;
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
use Aviat\AnimeClient\Model\Manga as MangaModel;
|
||||
use Aviat\AnimeClient\Types\FormItem;
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
use Aviat\Ion\Json;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Controller for manga list
|
||||
*/
|
||||
|
@ -15,12 +15,10 @@
|
||||
namespace Aviat\AnimeClient\Controller;
|
||||
|
||||
use Aviat\AnimeClient\API\Kitsu\Model;
|
||||
use Aviat\AnimeClient\API\Kitsu\Transformer\CharacterTransformer;
|
||||
use Aviat\AnimeClient\API\Kitsu\Transformer\PersonTransformer;
|
||||
use Aviat\AnimeClient\API\Kitsu\Transformer\{CharacterTransformer, PersonTransformer};
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
use Aviat\AnimeClient\Enum\EventType;
|
||||
use Aviat\Ion\Attribute\DefaultController;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{DefaultController, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Event;
|
||||
use Aviat\Ion\View\HtmlView;
|
||||
|
@ -18,8 +18,7 @@ use Aviat\AnimeClient\API\Kitsu\Model;
|
||||
use Aviat\AnimeClient\API\Kitsu\Transformer\PersonTransformer;
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
|
||||
|
@ -18,8 +18,7 @@ use Aura\Router\Exception\RouteNotFound;
|
||||
use Aviat\AnimeClient\API\Anilist\Model as AnilistModel;
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
use Aviat\AnimeClient\Model\Settings as SettingsModel;
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
|
||||
|
@ -18,8 +18,7 @@ use Aviat\AnimeClient\API\Kitsu\Model;
|
||||
use Aviat\AnimeClient\API\Kitsu\Transformer\UserTransformer;
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
|
||||
use Aviat\Ion\Attribute\Controller;
|
||||
use Aviat\Ion\Attribute\Route;
|
||||
use Aviat\Ion\Attribute\{Controller, Route};
|
||||
use Aviat\Ion\Di\ContainerInterface;
|
||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
||||
|
||||
|
@ -317,14 +317,15 @@ final class Dispatcher extends RoutingBase
|
||||
|
||||
$params = [];
|
||||
|
||||
switch ($failure->failedRule) {
|
||||
switch ($failure->failedRule)
|
||||
{
|
||||
case Rule\Allows::class:
|
||||
$params = [
|
||||
'http_code' => 405,
|
||||
'title' => '405 Method Not Allowed',
|
||||
'message' => 'Invalid HTTP Verb',
|
||||
];
|
||||
break;
|
||||
break;
|
||||
|
||||
case Rule\Accepts::class:
|
||||
$params = [
|
||||
@ -332,12 +333,12 @@ final class Dispatcher extends RoutingBase
|
||||
'title' => '406 Not Acceptable',
|
||||
'message' => 'Unacceptable content type',
|
||||
];
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Fall back to a 404 message
|
||||
$actionMethod = NOT_FOUND_METHOD;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -95,14 +95,7 @@ final class Settings
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists($key, $values) && is_scalar($values[$key]))
|
||||
{
|
||||
$value['value'] = $values[$key];
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['value'] = $value['default'] ?? '';
|
||||
}
|
||||
$value['value'] = array_key_exists($key, $values) && is_scalar($values[$key]) ? $values[$key] : $value['default'] ?? '';
|
||||
|
||||
foreach (['readonly', 'disabled'] as $flag)
|
||||
{
|
||||
|
@ -201,10 +201,8 @@ abstract class AbstractType implements ArrayAccess, Countable, Stringable
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
final protected function fromObject(mixed $parent = NULL): float|NULL|bool|int|array|string
|
||||
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
|
||||
final protected function fromObject(mixed $parent = NULL): float|null|bool|int|array|string
|
||||
{
|
||||
$object = $parent ?? $this;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user