Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
6 changed files with 40 additions and 7 deletions
Showing only changes of commit 45b545d32d - Show all commits

View File

@ -43,7 +43,6 @@ Update your anime/manga list on Kitsu.io and MyAnimeList.net
3. Configure settings in `app/config/config.toml` to your liking
4. Create the following directories if they don't exist, and make sure they are world writable
* app/logs
* public/js/cache
* public/images/avatars
* public/images/anime
* public/images/characters

View File

@ -28,6 +28,8 @@ $tomlConfig = loadToml(__DIR__);
return array_merge($tomlConfig, [
'asset_dir' => "{$ROOT_DIR}/public",
'base_config_dir' => __DIR__,
'config_dir' => "{$APP_DIR}/config",
// Template file path
'view_path' => "{$APP_DIR}/views",

View File

@ -215,6 +215,12 @@ return [
'controller' => DEFAULT_CONTROLLER,
'verb' => 'get',
],
'settings-post' => [
'path' => '/settings',
'action' => 'settings',
'controller' => DEFAULT_CONTROLLER,
'verb' => 'post',
],
'login' => [
'path' => '/login',
'action' => 'login',

View File

@ -15,5 +15,3 @@ default_list = "anime" # anime or manga
default_anime_list_path = "watching" # watching|plan_to_watch|on_hold|dropped|completed|all
default_manga_list_path = "reading" # reading|plan_to_read|on_hold|dropped|completed|all
# Default view type (cover_view/list_view)
default_view_type = "cover_view"

View File

@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php
/**
* Hummingbird Anime List Client
*
@ -51,6 +51,7 @@ use Amp\Socket\{
use Amp\Uri\{
InvalidUriException, Uri
};
use const Aviat\AnimeClient\USER_AGENT;
use function Amp\{
asyncCall, call
};
@ -63,7 +64,7 @@ use function Amp\{
* @see Client
*/
final class HummingbirdClient implements Client {
const DEFAULT_USER_AGENT = 'Hummingbird Anime Client/5.0';
const DEFAULT_USER_AGENT = USER_AGENT;
private $cookieJar;
private $socketPool;

View File

@ -19,7 +19,7 @@ namespace Aviat\AnimeClient\Types;
use ArrayAccess;
use LogicException;
class AbstractType implements ArrayAccess {
abstract class AbstractType implements ArrayAccess {
/**
* Populate values for unserializing data
*
@ -83,7 +83,7 @@ class AbstractType implements ArrayAccess {
return;
}
if (!property_exists($this, $name))
if ( ! property_exists($this, $name))
{
$existing = json_encode($this);
@ -154,4 +154,31 @@ class AbstractType implements ArrayAccess {
unset($this->$offset);
}
}
/**
* Recursively cast properties to an array
*
* @param null $parent
* @return mixed
*/
public function toArray($parent = null)
{
$object = $parent ?? $this;
if (is_scalar($object))
{
return $object;
}
$output = [];
foreach ($object as $key => $value)
{
$output[$key] = is_scalar($value)
? $value
: $this->toArray((array) $value);
}
return $output;
}
}