Update EVERYTHING
This commit is contained in:
parent
08b61d08e9
commit
5e2a68dc84
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -14,9 +14,6 @@
|
|||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Bootstrap / Dependency Injection
|
|
||||||
*/
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aura\Html\HelperLocatorFactory;
|
use Aura\Html\HelperLocatorFactory;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -11,4 +11,5 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@ $animeclient_file_patterns = [
|
|||||||
'app/config/*.php',
|
'app/config/*.php',
|
||||||
'app/bootstrap.php',
|
'app/bootstrap.php',
|
||||||
'src/functions.php',
|
'src/functions.php',
|
||||||
'src/*.php'
|
'src/*.php',
|
||||||
|
'tests/**/*.php'
|
||||||
];
|
];
|
||||||
|
|
||||||
if ( ! function_exists('glob_recursive'))
|
if ( ! function_exists('glob_recursive'))
|
||||||
@ -26,21 +27,30 @@ if ( ! function_exists('glob_recursive'))
|
|||||||
|
|
||||||
function get_text_to_replace($tokens)
|
function get_text_to_replace($tokens)
|
||||||
{
|
{
|
||||||
if ($tokens[0][0] !== T_OPEN_TAG)
|
$output = '';
|
||||||
|
|
||||||
|
// Tokens have the follow structure if arrays:
|
||||||
|
// [0] => token type constant
|
||||||
|
// [1] => raw sytax parsed to that token
|
||||||
|
// [2] => line number
|
||||||
|
foreach($tokens as $token)
|
||||||
{
|
{
|
||||||
return NULL;
|
// Since we only care about opening docblocks,
|
||||||
|
// bail out when we get to the namespace token
|
||||||
|
if (is_array($token) && $token[0] === T_NAMESPACE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($token))
|
||||||
|
{
|
||||||
|
$token = $token[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is already a docblock, as the second token after the
|
return $output;
|
||||||
// open tag, get the contents of that token to replace
|
|
||||||
if ($tokens[1][0] === T_DOC_COMMENT)
|
|
||||||
{
|
|
||||||
return "<?php\n" . $tokens[1][1];
|
|
||||||
}
|
|
||||||
else if ($tokens[1][0] !== T_DOC_COMMENT)
|
|
||||||
{
|
|
||||||
return "<?php";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_tokens($source)
|
function get_tokens($source)
|
||||||
@ -53,11 +63,17 @@ function replace_files(array $files, $template)
|
|||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
{
|
{
|
||||||
$source = file_get_contents($file);
|
$source = file_get_contents($file);
|
||||||
|
|
||||||
|
if (stripos($source, 'namespace') === FALSE)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$tokens = get_tokens($source);
|
$tokens = get_tokens($source);
|
||||||
$text_to_replace = get_text_to_replace($tokens);
|
$text_to_replace = get_text_to_replace($tokens);
|
||||||
|
|
||||||
$header = file_get_contents(__DIR__ . $template);
|
$header = file_get_contents(__DIR__ . $template);
|
||||||
$new_text = "<?php\n{$header}";
|
$new_text = "<?php declare(strict_types=1);\n{$header}";
|
||||||
|
|
||||||
$new_source = str_replace($text_to_replace, $new_text, $source);
|
$new_source = str_replace($text_to_replace, $new_text, $source);
|
||||||
file_put_contents($file, $new_source);
|
file_put_contents($file, $new_source);
|
||||||
|
@ -40,6 +40,6 @@
|
|||||||
"consolidation/robo": "~1.0@RC",
|
"consolidation/robo": "~1.0@RC",
|
||||||
"henrikbjorn/lurker": "^1.1.0",
|
"henrikbjorn/lurker": "^1.1.0",
|
||||||
"symfony/var-dumper": "^3.1",
|
"symfony/var-dumper": "^3.1",
|
||||||
"squizlabs/php_codesniffer": "^3.0.0@alpha"
|
"squizlabs/php_codesniffer": "^3.0.0@beta"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -13,13 +13,12 @@
|
|||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
|
||||||
use Aviat\Ion\View\HttpView;
|
use Aviat\Ion\View\{HtmlView, HttpView, JsonView};
|
||||||
use Aviat\Ion\View\HtmlView;
|
use InvalidArgumentException;
|
||||||
use Aviat\Ion\View\JsonView;
|
|
||||||
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller base, defines output methods
|
* Controller base, defines output methods
|
||||||
@ -28,7 +27,7 @@ use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
|||||||
*/
|
*/
|
||||||
class Controller {
|
class Controller {
|
||||||
|
|
||||||
use \Aviat\Ion\Di\ContainerAware;
|
use ContainerAware;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache manager
|
* Cache manager
|
||||||
@ -166,7 +165,7 @@ class Controller {
|
|||||||
|
|
||||||
if (is_null($url))
|
if (is_null($url))
|
||||||
{
|
{
|
||||||
$url = ($util->is_view_page())
|
$url = $util->is_view_page()
|
||||||
? $this->request->url->get()
|
? $this->request->url->get()
|
||||||
: $server_params['HTTP_REFERER'];
|
: $server_params['HTTP_REFERER'];
|
||||||
}
|
}
|
||||||
@ -197,9 +196,9 @@ class Controller {
|
|||||||
* Get a class member
|
* Get a class member
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return object
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get($key)
|
public function __get(string $key)
|
||||||
{
|
{
|
||||||
$allowed = ['response', 'config'];
|
$allowed = ['response', 'config'];
|
||||||
|
|
||||||
@ -217,7 +216,7 @@ class Controller {
|
|||||||
* @param HtmlView $view
|
* @param HtmlView $view
|
||||||
* @param string $template
|
* @param string $template
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @throws \InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function load_partial($view, $template, array $data = [])
|
protected function load_partial($view, $template, array $data = [])
|
||||||
@ -230,17 +229,17 @@ class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$route = $router->get_route();
|
$route = $router->get_route();
|
||||||
$data['route_path'] = ($route) ? $router->get_route()->path : "";
|
$data['route_path'] = $route ? $router->get_route()->path : '';
|
||||||
|
|
||||||
|
|
||||||
$template_path = _dir($this->config->get('view_path'), "{$template}.php");
|
$template_path = _dir($this->config->get('view_path'), "{$template}.php");
|
||||||
|
|
||||||
if ( ! is_file($template_path))
|
if ( ! is_file($template_path))
|
||||||
{
|
{
|
||||||
throw new \InvalidArgumentException("Invalid template : {$template}");
|
throw new InvalidArgumentException("Invalid template : {$template}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $view->render_template($template_path, (array)$data);
|
return $view->renderTemplate($template_path, (array)$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,13 +270,13 @@ class Controller {
|
|||||||
* @param string $status
|
* @param string $status
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function login($status = "")
|
public function login(string $status = '')
|
||||||
{
|
{
|
||||||
$message = "";
|
$message = '';
|
||||||
|
|
||||||
$view = new HtmlView($this->container);
|
$view = new HtmlView($this->container);
|
||||||
|
|
||||||
if ($status !== "")
|
if ($status !== '')
|
||||||
{
|
{
|
||||||
$message = $this->show_message($view, 'error', $status);
|
$message = $this->show_message($view, 'error', $status);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient\Controller;
|
namespace Aviat\AnimeClient\Controller;
|
||||||
|
|
||||||
use Aviat\Ion\Json;
|
use Aviat\Ion\Json;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -33,17 +33,17 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
public function transform($item)
|
public function transform($item)
|
||||||
{
|
{
|
||||||
$anime =& $item['anime'];
|
$anime =& $item['anime'];
|
||||||
$genres = $this->linearize_genres($item['anime']['genres']);
|
$genres = $this->linearizeGenres($item['anime']['genres']);
|
||||||
|
|
||||||
$rating = NULL;
|
$rating = NULL;
|
||||||
if ($item['rating']['type'] === 'advanced')
|
if ($item['rating']['type'] === 'advanced')
|
||||||
{
|
{
|
||||||
$rating = (is_numeric($item['rating']['value']))
|
$rating = is_numeric($item['rating']['value'])
|
||||||
? intval(2 * $item['rating']['value'])
|
? (int) 2 * $item['rating']['value']
|
||||||
: '-';
|
: '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
$total_episodes = (is_numeric($anime['episode_count']))
|
$total_episodes = is_numeric($anime['episode_count'])
|
||||||
? $anime['episode_count']
|
? $anime['episode_count']
|
||||||
: '-';
|
: '-';
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
// a subset of the main title, don't list the
|
// a subset of the main title, don't list the
|
||||||
// alternate title
|
// alternate title
|
||||||
$not_subset = stripos($anime['title'], $anime['alternate_title']) === FALSE;
|
$not_subset = stripos($anime['title'], $anime['alternate_title']) === FALSE;
|
||||||
$diff = levenshtein($anime['title'], $anime['alternate_title']);
|
$diff = levenshtein($anime['title'], $anime['alternate_title'] ?? '');
|
||||||
if ($not_subset && $diff >= 5)
|
if ($not_subset && $diff >= 5)
|
||||||
{
|
{
|
||||||
$alternate_title = $anime['alternate_title'];
|
$alternate_title = $anime['alternate_title'];
|
||||||
@ -129,14 +129,14 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
/**
|
/**
|
||||||
* Simplify structure of genre list
|
* Simplify structure of genre list
|
||||||
*
|
*
|
||||||
* @param array $raw_genres
|
* @param array $rawGenres
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function linearize_genres(array $raw_genres)
|
protected function linearizeGenres(array $rawGenres): array
|
||||||
{
|
{
|
||||||
$genres = [];
|
$genres = [];
|
||||||
|
|
||||||
foreach ($raw_genres as $genre)
|
foreach ($rawGenres as $genre)
|
||||||
{
|
{
|
||||||
$genres[] = $genre['name'];
|
$genres[] = $genre['name'];
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
|
use Aviat\Ion\{ArrayWrapper, StringWrapper};
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,8 +24,8 @@ use Aviat\Ion\Di\ContainerInterface;
|
|||||||
*/
|
*/
|
||||||
class MenuGenerator extends UrlGenerator {
|
class MenuGenerator extends UrlGenerator {
|
||||||
|
|
||||||
use \Aviat\Ion\StringWrapper;
|
use ArrayWrapper;
|
||||||
use \Aviat\Ion\ArrayWrapper;
|
use StringWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Html generation helper
|
* Html generation helper
|
||||||
@ -87,7 +88,7 @@ class MenuGenerator extends UrlGenerator {
|
|||||||
$parsed_config = $this->parse_config($menus);
|
$parsed_config = $this->parse_config($menus);
|
||||||
|
|
||||||
// Bail out early on invalid menu
|
// Bail out early on invalid menu
|
||||||
if ( ! $this->arr($parsed_config)->has_key($menu))
|
if ( ! $this->arr($parsed_config)->hasKey($menu))
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
@ -160,7 +161,7 @@ class API extends Model {
|
|||||||
* @param string $sort_key
|
* @param string $sort_key
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function sort_by_name(&$array, $sort_key)
|
protected function sort_by_name(array &$array, string $sort_key)
|
||||||
{
|
{
|
||||||
$sort = [];
|
$sort = [];
|
||||||
|
|
||||||
@ -180,7 +181,7 @@ class API extends Model {
|
|||||||
* @param string $password
|
* @param string $password
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function authenticate($username, $password)
|
public function authenticate(string $username, string $password)
|
||||||
{
|
{
|
||||||
$response = $this->post(AnimeClient::HUMMINGBIRD_AUTH_URL, [
|
$response = $this->post(AnimeClient::HUMMINGBIRD_AUTH_URL, [
|
||||||
'form_params' => [
|
'form_params' => [
|
||||||
@ -191,7 +192,7 @@ class API extends Model {
|
|||||||
|
|
||||||
if ($response->getStatusCode() === 201)
|
if ($response->getStatusCode() === 201)
|
||||||
{
|
{
|
||||||
return json_decode($response->getBody(), TRUE);
|
return json_decode((string)$response->getBody(), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -205,7 +206,7 @@ class API extends Model {
|
|||||||
* @param string $status
|
* @param string $status
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function _get_list_from_api($status)
|
protected function _get_list_from_api(string $status): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -208,13 +208,13 @@ class Anime extends API {
|
|||||||
* @param string $status
|
* @param string $status
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function _get_list_from_api($status = "all")
|
protected function _get_list_from_api(string $status = "all"): array
|
||||||
{
|
{
|
||||||
$config = [
|
$config = [
|
||||||
'allow_redirects' => FALSE
|
'allow_redirects' => FALSE
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($status !== "all")
|
if ($status !== 'all')
|
||||||
{
|
{
|
||||||
$config['query']['status'] = $status;
|
$config['query']['status'] = $status;
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ class Anime extends API {
|
|||||||
{
|
{
|
||||||
$api_data = Json::decode($response->getBody(), TRUE);
|
$api_data = Json::decode($response->getBody(), TRUE);
|
||||||
$transformer = new AnimeListTransformer();
|
$transformer = new AnimeListTransformer();
|
||||||
$transformed = $transformer->transform_collection($api_data);
|
$transformed = $transformer->transformCollection($api_data);
|
||||||
return $transformed;
|
return $transformed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -16,11 +16,11 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use GuzzleHttp\Cookie\SetCookie;
|
|
||||||
|
|
||||||
use Aviat\Ion\Json;
|
|
||||||
use Aviat\AnimeClient\Hummingbird\Transformer;
|
use Aviat\AnimeClient\Hummingbird\Transformer;
|
||||||
use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus;
|
use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus;
|
||||||
|
use Aviat\Ion\Json;
|
||||||
|
use GuzzleHttp\Cookie\SetCookie;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for handling requests dealing with the manga list
|
* Model for handling requests dealing with the manga list
|
||||||
@ -59,7 +59,7 @@ class Manga extends API {
|
|||||||
* @param string|null $json
|
* @param string|null $json
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function _manga_api_call($type, $url, $json = NULL)
|
protected function _manga_api_call(string $type, string $url, $json = NULL): array
|
||||||
{
|
{
|
||||||
$token = $this->container->get('auth')
|
$token = $this->container->get('auth')
|
||||||
->get_auth_token();
|
->get_auth_token();
|
||||||
@ -144,7 +144,7 @@ class Manga extends API {
|
|||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function search($name)
|
public function search($name)
|
||||||
{
|
{
|
||||||
@ -162,10 +162,10 @@ class Manga extends API {
|
|||||||
|
|
||||||
if ((int) $response->getStatusCode() !== 200)
|
if ((int) $response->getStatusCode() !== 200)
|
||||||
{
|
{
|
||||||
$logger->warning("Non 200 response for search api call");
|
$logger->warning('Non 200 response for search api call');
|
||||||
$logger->warning($response->getBody());
|
$logger->warning($response->getBody());
|
||||||
|
|
||||||
throw new \RuntimeException($response->getEffectiveUrl());
|
throw new RuntimeException($response->getEffectiveUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json::decode($response->getBody(), TRUE);
|
return Json::decode($response->getBody(), TRUE);
|
||||||
@ -189,7 +189,7 @@ class Manga extends API {
|
|||||||
* @param string $status
|
* @param string $status
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function _get_list_from_api($status = "All")
|
public function _get_list_from_api(string $status = "All"): array
|
||||||
{
|
{
|
||||||
$config = [
|
$config = [
|
||||||
'query' => [
|
'query' => [
|
||||||
@ -220,11 +220,9 @@ class Manga extends API {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$zippered_data = $this->zipper_lists($api_data);
|
$zipperedData = $this->zipperLists($api_data);
|
||||||
$transformer = new Transformer\MangaListTransformer();
|
$transformer = new Transformer\MangaListTransformer();
|
||||||
$transformed_data = $transformer->transform_collection($zippered_data);
|
return $transformer->transformCollection($zipperedData);
|
||||||
|
|
||||||
return $transformed_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -281,7 +279,7 @@ class Manga extends API {
|
|||||||
* @param array $raw_data
|
* @param array $raw_data
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function zipper_lists($raw_data)
|
private function zipperLists($raw_data)
|
||||||
{
|
{
|
||||||
return (new Transformer\MangaListsZipper($raw_data))->transform();
|
return (new Transformer\MangaListsZipper($raw_data))->transform();
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
* @version 3.1
|
* @version 3.1
|
||||||
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
* @link https://github.com/timw4mail/HummingBirdAnimeClient
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
/**
|
/**
|
||||||
* Hummingbird Anime Client
|
* Hummingbird Anime Client
|
||||||
*
|
*
|
||||||
* An API client for Hummingbird to manage anime and manga watch lists
|
* An API client for Hummingbird to manage anime and manga watch lists
|
||||||
*
|
*
|
||||||
* PHP version 5.6
|
* PHP version 7
|
||||||
*
|
*
|
||||||
* @package HummingbirdAnimeClient
|
* @package HummingbirdAnimeClient
|
||||||
* @author Timothy J. Warren <tim@timshomepage.net>
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
||||||
@ -91,7 +91,7 @@ class Util {
|
|||||||
{
|
{
|
||||||
$url = $this->container->get('request')
|
$url = $this->container->get('request')
|
||||||
->getUri();
|
->getUri();
|
||||||
$page_segments = explode("/", $url);
|
$page_segments = explode("/", (string) $url);
|
||||||
|
|
||||||
$intersect = array_intersect($page_segments, self::$form_pages);
|
$intersect = array_intersect($page_segments, self::$form_pages);
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
use GuzzleHttp\Psr7\Response;
|
|
||||||
|
|
||||||
use Aviat\Ion\Friend;
|
use Aviat\Ion\Friend;
|
||||||
use Aviat\Ion\Json;
|
use Aviat\Ion\Json;
|
||||||
use Aviat\Ion\Di\ContainerInterface;
|
|
||||||
use Aviat\AnimeClient\Model\Manga as MangaModel;
|
|
||||||
use Aviat\AnimeClient\Hummingbird\Enum\MangaReadingStatus;
|
|
||||||
|
|
||||||
class MangaModelTest extends AnimeClient_TestCase {
|
class MangaModelTest extends AnimeClient_TestCase {
|
||||||
|
|
||||||
@ -22,7 +18,7 @@ class MangaModelTest extends AnimeClient_TestCase {
|
|||||||
$raw_data = Json::decodeFile($this->mockDir . '/manga.json');
|
$raw_data = Json::decodeFile($this->mockDir . '/manga.json');
|
||||||
$expected = Json::decodeFile($this->mockDir . '/manga-zippered.json');
|
$expected = Json::decodeFile($this->mockDir . '/manga-zippered.json');
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->model->zipper_lists($raw_data));
|
$this->assertEquals($expected, $this->model->zipperLists($raw_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMapByStatus()
|
public function testMapByStatus()
|
||||||
|
@ -36,7 +36,7 @@ class AnimeListTransformerTest extends AnimeClient_TestCase {
|
|||||||
*/
|
*/
|
||||||
public function testLinearizeGenres($original, $expected)
|
public function testLinearizeGenres($original, $expected)
|
||||||
{
|
{
|
||||||
$actual = $this->transformerFriend->linearize_genres($original);
|
$actual = $this->transformerFriend->linearizeGenres($original);
|
||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,8 +44,7 @@ class AnimeListTransformerTest extends AnimeClient_TestCase {
|
|||||||
{
|
{
|
||||||
$json = Json::decodeFile($this->start_file);
|
$json = Json::decodeFile($this->start_file);
|
||||||
$expected = Json::decodeFile($this->res_file);
|
$expected = Json::decodeFile($this->res_file);
|
||||||
$actual = $this->transformer->transform_collection($json);
|
$actual = $this->transformer->transformCollection($json);
|
||||||
//file_put_contents($this->res_file, json_encode($actual));
|
|
||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,7 +19,7 @@ class MangaListTransformerTest extends AnimeClient_TestCase {
|
|||||||
$orig_json = Json::decodeFile($this->start_file);
|
$orig_json = Json::decodeFile($this->start_file);
|
||||||
$expected = Json::decodeFile($this->res_file);
|
$expected = Json::decodeFile($this->res_file);
|
||||||
|
|
||||||
$actual = $this->transformer->transform_collection($orig_json);
|
$actual = $this->transformer->transformCollection($orig_json);
|
||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class MockBaseApiModel extends BaseApiModel {
|
|||||||
use MockInjectionTrait;
|
use MockInjectionTrait;
|
||||||
protected $base_url = 'https://httpbin.org/';
|
protected $base_url = 'https://httpbin.org/';
|
||||||
|
|
||||||
protected function _get_list_from_api($status)
|
protected function _get_list_from_api(string $status): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user