From 45b545d32dc6f9bbc23112876dd3462c3ce8344b Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Fri, 24 Aug 2018 14:23:01 -0400 Subject: [PATCH] Cleanup config a bit --- README.md | 1 - app/appConf/base_config.php | 2 ++ app/appConf/routes.php | 6 ++++++ app/config/route_config.toml.example | 2 -- src/API/HummingbirdClient.php | 5 +++-- src/Types/AbstractType.php | 31 ++++++++++++++++++++++++++-- 6 files changed, 40 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 337f94f5..b6baf74c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/appConf/base_config.php b/app/appConf/base_config.php index c58684aa..5811421c 100644 --- a/app/appConf/base_config.php +++ b/app/appConf/base_config.php @@ -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", diff --git a/app/appConf/routes.php b/app/appConf/routes.php index 07d1d1af..db05b416 100644 --- a/app/appConf/routes.php +++ b/app/appConf/routes.php @@ -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', diff --git a/app/config/route_config.toml.example b/app/config/route_config.toml.example index 74191a89..e5fabdfe 100644 --- a/app/config/route_config.toml.example +++ b/app/config/route_config.toml.example @@ -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" \ No newline at end of file diff --git a/src/API/HummingbirdClient.php b/src/API/HummingbirdClient.php index b79ebe86..9f39c221 100644 --- a/src/API/HummingbirdClient.php +++ b/src/API/HummingbirdClient.php @@ -1,4 +1,4 @@ -$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; + } } \ No newline at end of file