Merge remote-tracking branch 'origin/develop'
All checks were successful
timw4mail/HummingBirdAnimeClient/pipeline/head This commit looks good

This commit is contained in:
Timothy Warren 2023-07-13 12:28:24 -04:00
commit 5c17a8615b
206 changed files with 1403 additions and 1345 deletions

View File

@ -53,13 +53,13 @@ return (new Config())
'yield_from',
],
],
'braces' => [
'allow_single_line_anonymous_class_with_empty_body' => true,
'allow_single_line_closure' => true,
'position_after_anonymous_constructs' => 'same',
'position_after_control_structures' => 'next',
'position_after_functions_and_oop_constructs' => 'next',
],
// 'braces' => [
// 'allow_single_line_anonymous_class_with_empty_body' => true,
// 'allow_single_line_closure' => true,
// 'position_after_anonymous_constructs' => 'same',
// 'position_after_control_structures' => 'next',
// 'position_after_functions_and_oop_constructs' => 'next',
// ],
'cast_spaces' => ['space' => 'single'],
'class_attributes_separation' => [
'elements' => [
@ -93,7 +93,16 @@ return (new Config())
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'constant_case' => ['case' => 'upper'],
'control_structure_braces' => true,
'control_structure_continuation_position' => ['position' => 'next_line'],
'curly_braces_position' => [
'allow_single_line_anonymous_functions' => true,
'allow_single_line_empty_anonymous_classes' => true,
'anonymous_functions_opening_brace' => 'same_line',
'classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end',
'functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
],
'date_time_immutable' => false,
'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
@ -108,7 +117,7 @@ return (new Config())
'long_function' => 'echo',
'shorten_simple_statements_only' => false,
],
'elseif' => true,
'elseif' => false,
'empty_loop_body' => ['style' => 'braces'],
'empty_loop_condition' => ['style' => 'while'],
'encoding' => true,
@ -429,8 +438,8 @@ return (new Config())
'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']],
'single_line_throw' => false,
'single_quote' => ['strings_containing_single_quote_chars' => false],
'single_space_after_construct' => [
'constructs' => [
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'abstract',
'as',
'attribute',
@ -493,6 +502,7 @@ return (new Config())
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
'standardize_increment' => true,
'standardize_not_equals' => true,
'statement_indentation' => true,
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,

View File

@ -31,12 +31,18 @@ Update your anime/manga list on Kitsu.io and Anilist
### Requirements
* PHP 8
* PDO SQLite or PDO PostgreSQL (For collection tab)
* GD extension for caching images
* PHP 8.2
* ext-dom (For editing the DOM)
* ext-gd (For caching images)
* ext-intl (For time localization)
* ext-json
* ext-mbstring
* ext-pdo
### Highly Recommended
* Redis or Memcached for caching
* PDO SQLite or PDO PostgreSQL (For collection tab)
### Installation

View File

@ -19,7 +19,8 @@ use const Aviat\AnimeClient\{
DEFAULT_CONTROLLER,
DEFAULT_CONTROLLER_METHOD,
NUM_PATTERN,
SLUG_PATTERN
SLUG_PATTERN,
SLUG_SPACE_PATTERN,
};
// -------------------------------------------------------------------------
@ -291,7 +292,7 @@ $routes = [
'action' => 'edit',
'tokens' => [
'id' => SLUG_PATTERN,
'status' => '([a-zA-Z\-_]|%20)+',
'status' => SLUG_SPACE_PATTERN,
],
],
'list' => [

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

View File

@ -14,6 +14,9 @@ show_anime_collection = true
# do you wish to show the manga collection?
show_manga_collection = false
# what theme would you like to use? light, dark, or auto
theme = "auto"
################################################################################
# Default views and paths
################################################################################

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

View File

@ -13,8 +13,8 @@
"autoload": {
"files": [
"src/Ion/functions.php",
"src/AnimeClient/constants.php",
"src/AnimeClient/AnimeClient.php"
"src/AnimeClient.php",
"src/AnimeClient/constants.php"
],
"psr-4": {
"Aviat\\": "src/"

View File

@ -11,8 +11,8 @@
"devDependencies": {
"@swc/cli": "^0.1.39",
"@swc/core": "^1.2.54",
"concurrently": "^7.4.0",
"cssnano": "^5.0.1",
"concurrently": "^8.2.0",
"cssnano": "^6.0.1",
"postcss": "^8.2.6",
"postcss-import": "^15.0.0",
"postcss-preset-env": "^8.0.1",

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"sources":["/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/base/sort-tables.js"],"sourcesContent":["const LightTableSorter = (() => {\n\tlet th = null;\n\tlet cellIndex = null;\n\tlet order = '';\n\tconst text = (row) => row.cells.item(cellIndex).textContent.toLowerCase();\n\tconst sort = (a, b) => {\n\t\tlet textA = text(a);\n\t\tlet textB = text(b);\n\t\tconsole.log(\"Comparing \" + textA + \" and \" + textB)\n\n\t\tif(th.classList.contains(\"numeric\")){\n\t\t\tlet arrayA = textA.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tlet arrayB = textB.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tif(arrayA.length > 1) {\n\t\t\t\ttextA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10);\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttextA = parseInt(arrayA[0],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10);\n\t\t\t}\n\t\t}\n\t\telse if (parseInt(textA, 10)) {\n\t\t\ttextA = parseInt(textA, 10);\n\t\t\ttextB = parseInt(textB, 10);\n\t\t}\n\t\tif (textA > textB) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (textA < textB) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t};\n\tconst toggle = () => {\n\t\tconst c = order !== 'sorting-asc' ? 'sorting-asc' : 'sorting-desc';\n\t\tth.className = (th.className.replace(order, '') + ' ' + c).trim();\n\t\treturn order = c;\n\t};\n\tconst reset = () => {\n\t\tth.classList.remove('sorting-asc', 'sorting-desc');\n\t\tth.classList.add('sorting');\n\t\treturn order = '';\n\t};\n\tconst onClickEvent = (e) => {\n\t\tif (th && (cellIndex !== e.target.cellIndex)) {\n\t\t\treset();\n\t\t}\n\t\tth = e.target;\n\t\tif (th.nodeName.toLowerCase() === 'th') {\n\t\t\tcellIndex = th.cellIndex;\n\t\t\tconst tbody = th.offsetParent.getElementsByTagName('tbody')[0];\n\t\t\tlet rows = Array.from(tbody.rows);\n\t\t\tif (rows) {\n\t\t\t\trows.sort(sort);\n\t\t\t\tif (order === 'sorting-asc') {\n\t\t\t\t\trows.reverse();\n\t\t\t\t}\n\t\t\t\ttoggle();\n\t\t\t\ttbody.innerHtml = '';\n\n\t\t\t\trows.forEach(row => {\n\t\t\t\t\ttbody.appendChild(row);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tinit: () => {\n\t\t\tlet ths = document.getElementsByTagName('th');\n\t\t\tlet results = [];\n\t\t\tfor (let i = 0, len = ths.length; i < len; i++) {\n\t\t\t\tlet th = ths[i];\n\t\t\t\tth.classList.add('sorting');\n\t\t\t\tth.classList.add('testing');\n\t\t\t\tresults.push(th.onclick = onClickEvent);\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n\t};\n})();\n\nLightTableSorter.init();"],"names":[],"mappings":"AAAA,MAAM,iBAAmB,AAAC,CAAA,KACzB,IAAI,GAAK,KACT,IAAI,UAAY,KAChB,IAAI,MAAQ,GACZ,MAAM,KAAO,AAAC,KAAQ,IAAI,MAAM,KAAK,WAAW,YAAY,cAC5D,MAAM,KAAO,CAAC,EAAG,KAChB,IAAI,MAAQ,KAAK,GACjB,IAAI,MAAQ,KAAK,GACjB,QAAQ,IAAI,aAAe,MAAQ,QAAU,OAE7C,GAAG,GAAG,UAAU,SAAS,WAAW,CACnC,IAAI,OAAS,MAAM,QAAQ,cAAc,IAAI,QAAQ,IAAI,GAAG,MAAM,KAClE,IAAI,OAAS,MAAM,QAAQ,cAAc,IAAI,QAAQ,IAAI,GAAG,MAAM,KAClE,GAAG,OAAO,OAAS,EAAG,CACrB,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,IAAM,SAAS,MAAM,CAAC,EAAE,CAAC,IACpD,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,IAAM,SAAS,MAAM,CAAC,EAAE,CAAC,GACrD,KACI,CACH,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,IAC3B,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,GAC5B,CACD,MACK,GAAI,SAAS,MAAO,IAAK,CAC7B,MAAQ,SAAS,MAAO,IACxB,MAAQ,SAAS,MAAO,GACzB,CACA,GAAI,MAAQ,MACX,OAAO,EAER,GAAI,MAAQ,MACX,OAAO,GAER,OAAO,CACR,EACA,MAAM,OAAS,KACd,MAAM,EAAI,QAAU,cAAgB,cAAgB,cACpD,CAAA,GAAG,UAAY,AAAC,CAAA,GAAG,UAAU,QAAQ,MAAO,IAAM,IAAM,CAAA,EAAG,OAC3D,OAAO,MAAQ,CAChB,EACA,MAAM,MAAQ,KACb,GAAG,UAAU,OAAO,cAAe,gBACnC,GAAG,UAAU,IAAI,WACjB,OAAO,MAAQ,EAChB,EACA,MAAM,aAAe,AAAC,IACrB,GAAI,IAAO,YAAc,EAAE,OAAO,UACjC,QAED,GAAK,EAAE,OACP,GAAI,GAAG,SAAS,gBAAkB,KAAM,CACvC,UAAY,GAAG,UACf,MAAM,MAAQ,GAAG,aAAa,qBAAqB,QAAQ,CAAC,EAAE,CAC9D,IAAI,KAAO,MAAM,KAAK,MAAM,MAC5B,GAAI,KAAM,CACT,KAAK,KAAK,MACV,GAAI,QAAU,cACb,KAAK,UAEN,QACA,CAAA,MAAM,UAAY,GAElB,KAAK,QAAQ,MACZ,MAAM,YAAY,IACnB,EACD,CACD,CACD,EACA,MAAO,CACN,KAAM,KACL,IAAI,IAAM,SAAS,qBAAqB,MACxC,IAAI,QAAU,EAAE,CAChB,IAAK,IAAI,EAAI,EAAG,IAAM,IAAI,OAAQ,EAAI,IAAK,IAAK,CAC/C,IAAI,GAAK,GAAG,CAAC,EAAE,CACf,GAAG,UAAU,IAAI,WACjB,GAAG,UAAU,IAAI,WACjB,QAAQ,KAAK,GAAG,QAAU,aAC3B,CACA,OAAO,OACR,CACD,CACD,CAAA,IAEA,iBAAiB"}
{"version":3,"sources":["/var/www/htdocs/github.timshomepage.net/animeclient/frontEndSrc/js/base/sort-tables.js"],"sourcesContent":["const LightTableSorter = (() => {\n\tlet th = null;\n\tlet cellIndex = null;\n\tlet order = '';\n\tconst text = (row) => row.cells.item(cellIndex).textContent.toLowerCase();\n\tconst sort = (a, b) => {\n\t\tlet textA = text(a);\n\t\tlet textB = text(b);\n\t\tconsole.log(\"Comparing \" + textA + \" and \" + textB)\n\n\t\tif(th.classList.contains(\"numeric\")){\n\t\t\tlet arrayA = textA.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tlet arrayB = textB.replace('episodes: ','').replace('-',0).split(\"/\");\n\t\t\tif(arrayA.length > 1) {\n\t\t\t\ttextA = parseInt(arrayA[0],10) / parseInt(arrayA[1],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10) / parseInt(arrayB[1],10);\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttextA = parseInt(arrayA[0],10);\n\t\t\t\ttextB = parseInt(arrayB[0],10);\n\t\t\t}\n\t\t}\n\t\telse if (parseInt(textA, 10)) {\n\t\t\ttextA = parseInt(textA, 10);\n\t\t\ttextB = parseInt(textB, 10);\n\t\t}\n\t\tif (textA > textB) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (textA < textB) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t};\n\tconst toggle = () => {\n\t\tconst c = order !== 'sorting-asc' ? 'sorting-asc' : 'sorting-desc';\n\t\tth.className = (th.className.replace(order, '') + ' ' + c).trim();\n\t\treturn order = c;\n\t};\n\tconst reset = () => {\n\t\tth.classList.remove('sorting-asc', 'sorting-desc');\n\t\tth.classList.add('sorting');\n\t\treturn order = '';\n\t};\n\tconst onClickEvent = (e) => {\n\t\tif (th && (cellIndex !== e.target.cellIndex)) {\n\t\t\treset();\n\t\t}\n\t\tth = e.target;\n\t\tif (th.nodeName.toLowerCase() === 'th') {\n\t\t\tcellIndex = th.cellIndex;\n\t\t\tconst tbody = th.offsetParent.getElementsByTagName('tbody')[0];\n\t\t\tlet rows = Array.from(tbody.rows);\n\t\t\tif (rows) {\n\t\t\t\trows.sort(sort);\n\t\t\t\tif (order === 'sorting-asc') {\n\t\t\t\t\trows.reverse();\n\t\t\t\t}\n\t\t\t\ttoggle();\n\t\t\t\ttbody.innerHtml = '';\n\n\t\t\t\trows.forEach(row => {\n\t\t\t\t\ttbody.appendChild(row);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n\treturn {\n\t\tinit: () => {\n\t\t\tlet ths = document.getElementsByTagName('th');\n\t\t\tlet results = [];\n\t\t\tfor (let i = 0, len = ths.length; i < len; i++) {\n\t\t\t\tlet th = ths[i];\n\t\t\t\tth.classList.add('sorting');\n\t\t\t\tth.classList.add('testing');\n\t\t\t\tresults.push(th.onclick = onClickEvent);\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n\t};\n})();\n\nLightTableSorter.init();"],"names":[],"mappings":"AAAA,MAAM,iBAAmB,AAAC,CAAA,KACzB,IAAI,GAAK,KACT,IAAI,UAAY,KAChB,IAAI,MAAQ,GACZ,MAAM,KAAO,AAAC,KAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,WAAW,CAAC,WAAW,GACvE,MAAM,KAAO,CAAC,EAAG,KAChB,IAAI,MAAQ,KAAK,GACjB,IAAI,MAAQ,KAAK,GACjB,QAAQ,GAAG,CAAC,aAAe,MAAQ,QAAU,OAE7C,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,CACnC,IAAI,OAAS,MAAM,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,KAClE,IAAI,OAAS,MAAM,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,KAClE,GAAG,OAAO,MAAM,CAAG,EAAG,CACrB,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,IAAM,SAAS,MAAM,CAAC,EAAE,CAAC,IACpD,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,IAAM,SAAS,MAAM,CAAC,EAAE,CAAC,GACrD,KACI,CACH,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,IAC3B,MAAQ,SAAS,MAAM,CAAC,EAAE,CAAC,GAC5B,CACD,MACK,GAAI,SAAS,MAAO,IAAK,CAC7B,MAAQ,SAAS,MAAO,IACxB,MAAQ,SAAS,MAAO,GACzB,CACA,GAAI,MAAQ,MACX,OAAO,EAER,GAAI,MAAQ,MACX,OAAO,GAER,OAAO,CACR,EACA,MAAM,OAAS,KACd,MAAM,EAAI,QAAU,cAAgB,cAAgB,cACpD,CAAA,GAAG,SAAS,CAAG,AAAC,CAAA,GAAG,SAAS,CAAC,OAAO,CAAC,MAAO,IAAM,IAAM,CAAA,EAAG,IAAI,GAC/D,OAAO,MAAQ,CAChB,EACA,MAAM,MAAQ,KACb,GAAG,SAAS,CAAC,MAAM,CAAC,cAAe,gBACnC,GAAG,SAAS,CAAC,GAAG,CAAC,WACjB,OAAO,MAAQ,EAChB,EACA,MAAM,aAAe,AAAC,IACrB,GAAI,IAAO,YAAc,EAAE,MAAM,CAAC,SAAS,CAC1C,QAED,GAAK,EAAE,MAAM,CACb,GAAI,GAAG,QAAQ,CAAC,WAAW,KAAO,KAAM,CACvC,UAAY,GAAG,SAAS,CACxB,MAAM,MAAQ,GAAG,YAAY,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAC9D,IAAI,KAAO,MAAM,IAAI,CAAC,MAAM,IAAI,EAChC,GAAI,KAAM,CACT,KAAK,IAAI,CAAC,MACV,GAAI,QAAU,cACb,KAAK,OAAO,GAEb,QACA,CAAA,MAAM,SAAS,CAAG,GAElB,KAAK,OAAO,CAAC,MACZ,MAAM,WAAW,CAAC,IACnB,EACD,CACD,CACD,EACA,MAAO,CACN,KAAM,KACL,IAAI,IAAM,SAAS,oBAAoB,CAAC,MACxC,IAAI,QAAU,EAAE,CAChB,IAAK,IAAI,EAAI,EAAG,IAAM,IAAI,MAAM,CAAE,EAAI,IAAK,IAAK,CAC/C,IAAI,GAAK,GAAG,CAAC,EAAE,CACf,GAAG,SAAS,CAAC,GAAG,CAAC,WACjB,GAAG,SAAS,CAAC,GAAG,CAAC,WACjB,QAAQ,IAAI,CAAC,GAAG,OAAO,CAAG,aAC3B,CACA,OAAO,OACR,CACD,CACD,CAAA,IAEA,iBAAiB,IAAI"}

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;
@ -18,7 +18,7 @@ use Amp\Http\Client\{HttpClient, HttpClientBuilder, Request, Response};
use Aviat\Ion\{ConfigInterface, ImageBuilder};
use DateTimeImmutable;
use Psr\SimpleCache\CacheInterface;
use Psr\SimpleCache\{CacheInterface, InvalidArgumentException};
use Throwable;
use Yosymfony\Toml\{Toml, TomlBuilder};
@ -218,7 +218,7 @@ function getResponse(Request|string $request): Response
*/
function getLocalImg(string $kitsuUrl, bool $webp = TRUE): string
{
if (empty($kitsuUrl) || ( ! is_string($kitsuUrl)))
if (empty($kitsuUrl))
{
return 'images/placeholder.webp';
}
@ -276,6 +276,7 @@ function colNotEmpty(array $search, string $key): bool
/**
* Clear the cache, but save user auth data
* @throws InvalidArgumentException
*/
function clearCache(CacheInterface $cache): bool
{

View File

@ -4,26 +4,26 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API;
// use Amp\Http\Client\Form;
use Amp\Http\Client\Body\FormBody;
use Amp\Http\Client\Request;
use Amp\Http\Client\{HttpClientBuilder, HttpException, Request};
use Aviat\Ion\Json;
use Error;
use InvalidArgumentException;
use Psr\Log\LoggerAwareTrait;
use Throwable;
use TypeError;
// use function Amp\async;
// use function Amp\Future\await;
use function Amp\Promise\wait;
use function Aviat\AnimeClient\getResponse;
use const Aviat\AnimeClient\USER_AGENT;
@ -203,18 +203,15 @@ abstract class APIRequestBuilder
{
$this->buildUri();
if ($this->logger !== NULL)
{
$this->logger->debug('API Request', [
'request_url' => $this->request->getUri(),
'request_headers' => $this->request->getHeaders(),
'request_body' => wait(
$this->request->getBody()
->createBodyStream()
->read()
),
]);
}
$this->logger?->debug('API Request', [
'request_url' => $this->request->getUri(),
'request_headers' => $this->request->getHeaders(),
'request_body' => wait(
$this->request->getBody()
->createBodyStream()
->read()
),
]);
return $this->request;
}
@ -222,12 +219,9 @@ abstract class APIRequestBuilder
/**
* Get the data from the response of the passed request
*
* @throws Error
* @throws Throwable
* @throws TypeError
* @return mixed
*/
public function getResponseData(Request $request)
public function getResponseData(Request $request): mixed
{
$response = getResponse($request);

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API;
@ -38,7 +38,6 @@ abstract class AbstractListItem
* Retrieve a list item
*
* @param string $id - The id of the list item
* @return mixed[]
*/
abstract public function get(string $id): array;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Anilist\Types;

View File

@ -4,17 +4,17 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API;
use Psr\SimpleCache\CacheInterface;
use Psr\SimpleCache\{CacheInterface, InvalidArgumentException};
/**
* Helper methods for dealing with the Cache
@ -44,6 +44,7 @@ trait CacheTrait
/**
* Get the cached value if it exists, otherwise set the cache value
* and return it.
* @throws InvalidArgumentException
*/
public function getCached(string $key, callable $primer, ?array $primeArgs = []): mixed
{

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\AnimeWatchingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\AnimeWatchingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\AnimeWatchingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\AnimeWatchingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\MangaReadingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\MangaReadingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\MangaReadingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Enum\MangaReadingStatus;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Enum;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Enum;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu;

View File

@ -4,19 +4,18 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu;
use Amp\Http\Client\{Request, Response};
use Aviat\AnimeClient\API\APIRequestBuilder;
use Aviat\AnimeClient\Enum\EventType;
use Aviat\AnimeClient\Kitsu as K;
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
use Aviat\Ion\{Event, Json, JsonException};

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;
@ -54,7 +54,7 @@ final class MangaTransformer extends AbstractTransformer
}
$details = $rawCharacter['character'];
if (array_key_exists($details['id'], (array)$characters[$type]))
if (array_key_exists($details['id'], (array) $characters[$type]))
{
$characters[$type][$details['id']] = [
'image' => Kitsu::getImage($details),

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Kitsu\Transformer;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Mapping;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API\Mapping;

View File

@ -4,21 +4,22 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\API;
use Amp\Http\Client\Request;
use Amp\Http\Client\{HttpException, Request};
use Generator;
use Throwable;
use function Amp\call;
// use function Amp\Future\{async, await};
use function Amp\Promise\{all, wait};
use function Aviat\AnimeClient\getApiClient;
@ -65,9 +66,23 @@ final class ParallelAPIRequest
* Make the requests, and return the body for each
*
* @throws Throwable
* @return mixed[]
*/
public function makeRequests(): array
{
return $this->makeRequestOld();
}
/**
* Make the requests and return the response objects
*
* @throws Throwable
*/
public function getResponses(): array
{
return $this->getResponsesOld();
}
private function makeRequestOld(): array
{
$client = getApiClient();
@ -84,13 +99,19 @@ final class ParallelAPIRequest
return wait(all($promises));
}
/**
* Make the requests and return the response objects
*
* @throws Throwable
* @return mixed[]
*/
public function getResponses(): array
private function makeRequestsNew(): array
{
$futures = [];
foreach ($this->requests as $key => $url)
{
$futures[$key] = async(static fn () => self::bodyHandler($url));
}
return await($futures);
}
private function getResponsesOld(): array
{
$client = getApiClient();
@ -103,4 +124,41 @@ final class ParallelAPIRequest
return wait(all($promises));
}
private function getResponsesNew(): array
{
$futures = [];
foreach ($this->requests as $key => $url)
{
$futures[$key] = async(static fn () => self::responseHandler($url));
}
return await($futures);
}
private static function bodyHandler(string|Request $uri): string
{
$client = getApiClient();
if (is_string($uri))
{
$uri = new Request($uri);
}
$response = $client->request($uri);
return $response->getBody()->buffer();
}
private static function responseHandler(string|Request $uri)
{
$client = getApiClient();
if (is_string($uri))
{
$uri = new Request($uri);
}
return $client->request($uri);
}
}

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Command;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Command;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Command;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Command;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Command;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Command;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Component;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Component;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Component;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Component;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Component;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Component;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Component;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;
@ -120,194 +120,185 @@ class Controller
Event::on(EventType::RESET_CACHE_KEY, fn (string $key) => $this->cache->delete($key));
}
/**
* 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();
/**
* Set the current url in the session as the target of a future redirect
*
* @throws ContainerException
* @throws NotFoundException
*/
public function setSessionRedirect(?string $url = NULL): void
{
$serverParams = $this->request->getServerParams();
if ( ! array_key_exists('HTTP_REFERER', $serverParams))
{
return;
}
if ( ! array_key_exists('HTTP_REFERER', $serverParams))
{
return;
}
$util = $this->container->get('util');
$doubleFormPage = $serverParams['HTTP_REFERER'] === $this->request->getUri();
$isLoginPage = str_contains($serverParams['HTTP_REFERER'], 'login');
$util = $this->container->get('util');
$doubleFormPage = $serverParams['HTTP_REFERER'] === $this->request->getUri();
$isLoginPage = str_contains($serverParams['HTTP_REFERER'], 'login');
// Don't attempt to set the redirect url if
// the page is one of the form type pages,
// and the previous page is also a form type
if ($doubleFormPage || $isLoginPage)
{
return;
}
// Don't attempt to set the redirect url if
// the page is one of the form type pages,
// and the previous page is also a form type
if ($doubleFormPage || $isLoginPage)
{
return;
}
if (NULL === $url)
{
$url = $util->isViewPage()
? (string) $this->request->getUri()
: $serverParams['HTTP_REFERER'];
}
if (NULL === $url)
{
$url = $util->isViewPage()
? (string) $this->request->getUri()
: $serverParams['HTTP_REFERER'];
}
$this->session->set('redirect_url', $url);
}
$this->session->set('redirect_url', $url);
}
/**
* 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') ?? '/';
/**
* Redirect to the url previously set in the session
*
* If one is not set, redirect to default url
*
* @throws InvalidArgumentException
*/
public function sessionRedirect(): void
{
$target = $this->session->get('redirect_url') ?? '/';
$this->redirect($target, 303);
$this->session->set('redirect_url', NULL);
}
$this->redirect($target, 303);
$this->session->set('redirect_url', NULL);
}
/**
* Check if the current user is authenticated, else error and exit
*/
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
protected function checkAuth(): void
{
if ( ! $this->auth->isAuthenticated())
{
$this->errorPage(
403,
'Forbidden',
'You must <a href="/login">log in</a> to perform this action.'
);
}
}
/**
* Check if the current user is authenticated, else error and exit
*/
protected function checkAuth(): void
{
if ( ! $this->auth->isAuthenticated())
{
$this->errorPage(
403,
'Forbidden',
'You must <a href="/login">log in</a> to perform this action.'
);
}
}
/**
* 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');
/**
* Get the string output of a partial template
*/
protected function loadPartial(HtmlView $view, string $template, array $data = []): string
{
$router = $this->container->get('dispatcher');
if (isset($this->baseData))
{
$data = array_merge($this->baseData, $data);
}
if (isset($this->baseData))
{
$data = array_merge($this->baseData, $data);
}
$route = $router->getRoute();
$data['route_path'] = $route !== FALSE ? $route->path : '';
$route = $router->getRoute();
$data['route_path'] = $route !== FALSE ? $route->path : '';
$templatePath = _dir($this->config->get('view_path'), "{$template}.php");
$templatePath = _dir($this->config->get('view_path'), "{$template}.php");
if ( ! is_file($templatePath))
{
throw new InvalidArgumentException("Invalid template : {$template}");
}
if ( ! is_file($templatePath))
{
throw new InvalidArgumentException("Invalid template : {$template}");
}
return $view->renderTemplate($templatePath, $data);
}
return $view->renderTemplate($templatePath, $data);
}
/**
* 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",
"object-src 'none'",
"child-src 'self' *.youtube.com polyfill.io",
];
/**
* Render a template with header and footer
*/
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",
"object-src 'none'",
"child-src 'self' *.youtube.com polyfill.io",
];
$view->addHeader('Content-Security-Policy', implode('; ', $csp));
$view->appendOutput($this->loadPartial($view, 'header', $data));
$view->addHeader('Content-Security-Policy', implode('; ', $csp));
$view->appendOutput($this->loadPartial($view, 'header', $data));
if (array_key_exists('message', $data) && is_array($data['message']))
{
$view->appendOutput($this->loadPartial($view, 'message', $data['message']));
}
if (array_key_exists('message', $data) && is_array($data['message']))
{
$view->appendOutput($this->loadPartial($view, 'message', $data['message']));
}
$view->appendOutput($this->loadPartial($view, $template, $data));
$view->appendOutput($this->loadPartial($view, 'footer', $data));
$view->appendOutput($this->loadPartial($view, $template, $data));
$view->appendOutput($this->loadPartial($view, 'footer', $data));
return $view;
}
return $view;
}
/**
* 404 action
*
* @throws InvalidArgumentException
*/
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
public function notFound(
string $title = 'Sorry, page not found',
string $message = 'Page Not Found'
): never {
$this->outputHTML('404', [
'title' => $title,
'message' => $message,
], NULL, 404);
/**
* 404 action
*
* @throws InvalidArgumentException
*/
public function notFound(
string $title = 'Sorry, page not found',
string $message = 'Page Not Found'
): never {
$this->outputHTML('404', [
'title' => $title,
'message' => $message,
], NULL, 404);
exit();
}
exit();
}
/**
* 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,
'message' => $message,
'long_message' => $longMessage,
], NULL, $httpCode);
}
/**
* Display a generic error page
*
* @throws InvalidArgumentException
*/
public function errorPage(int $httpCode, string $title, string $message, string $longMessage = ''): void
{
$this->outputHTML('error', [
'title' => $title,
'message' => $message,
'long_message' => $longMessage,
], NULL, $httpCode);
}
/**
* 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);
}
/**
* Redirect to the default controller/url from an empty path
*
* @throws InvalidArgumentException
*/
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
*/
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
public function setFlashMessage(string $message, string $type = 'info'): void
{
static $messages;
/**
* Set a session flash variable to display a message on
* next page load
*/
public function setFlashMessage(string $message, string $type = 'info'): void
{
static $messages;
if ( ! $messages)
{
$messages = [];
}
if ( ! $messages)
{
$messages = [];
}
$messages[] = [
'message_type' => $type,
'message' => $message,
];
$messages[] = [
'message_type' => $type,
'message' => $message,
];
$this->session->setFlash('message', $messages);
}
$this->session->setFlash('message', $messages);
}
/**
* Helper for consistent page titles
@ -319,62 +310,58 @@ class Controller
return implode(' &middot; ', $parts);
}
/**
* 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,
'message' => $message,
]);
}
/**
* Add a message box to the page
*
* @throws InvalidArgumentException
*/
protected function showMessage(HtmlView $view, string $type, string $message): string
{
return $this->loadPartial($view, 'message', [
'message_type' => $type,
'message' => $message,
]);
}
/**
* 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)
{
$view = new HtmlView($this->container);
}
/**
* Output a template to HTML, using the provided data
*
* @throws InvalidArgumentException
*/
protected function outputHTML(string $template, array $data = [], ?HtmlView $view = NULL, int $code = 200): void
{
if (NULL === $view)
{
$view = new HtmlView($this->container);
}
$view->setStatusCode($code);
$this->renderFullPage($view, $template, $data)->send();
}
$view->setStatusCode($code);
$this->renderFullPage($view, $template, $data)->send();
}
/**
* 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)
->setStatusCode($code)
->send();
}
/**
* Output a JSON Response
*
* @param int $code - the http status code
* @throws DoubleRenderException
*/
protected function outputJSON(mixed $data, int $code): void
{
JsonView::new()
->setOutput($data)
->setStatusCode($code)
->send();
}
/**
* Redirect to the selected page
*/
#[\PHPUnit\Framework\Attributes\CodeCoverageIgnore]
protected function redirect(string $url, int $code): void
{
HttpView::new()
->redirect($url, $code)
->send();
}
/**
* Redirect to the selected page
*/
protected function redirect(string $url, int $code): void
{
HttpView::new()
->redirect($url, $code)
->send();
}
}
// End of BaseController.php

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Controller;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;
@ -214,8 +214,6 @@ final class Dispatcher extends RoutingBase
/**
* Get the list of controllers in the default namespace
*
* @return array
*/
public function getControllerList(): array
{

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Enum;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Enum;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Enum;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Enum;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Helper;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Helper;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Helper;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Model;

View File

@ -4,12 +4,12 @@
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
* PHP version 8.1
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @copyright 2015 - 2023 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient;

Some files were not shown because too many files have changed in this diff Show More