From a71fb185bd09f900f9815fc0ba3b79bd12452d74 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 24 Aug 2018 14:36:58 -0400 Subject: [PATCH] Add Config 'Type', to keep config settings somewhat in check --- src/Types/Config.php | 97 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/Types/Config.php diff --git a/src/Types/Config.php b/src/Types/Config.php new file mode 100644 index 00000000..24cd5e74 --- /dev/null +++ b/src/Types/Config.php @@ -0,0 +1,97 @@ + + * @copyright 2015 - 2018 Timothy J. Warren + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @version 4.0 + * @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient + */ + +namespace Aviat\AnimeClient\Types; + +class Config extends AbstractType { + // Config files/namespaces + public $anilist; + public $cache; + public $database; + public $route_config; + + // Settings in config.toml + public $kitsu_username; + public $show_anime_collection; + public $show_manga_collection; + public $whose_list; + + // Application config + public $menus; + public $routes; + + // Generated config values + public $asset_dir; + public $base_config_dir; + public $config_dir; + public $data_cache_path; + public $img_cache_path; + public $view_path; + + public function setAnilist ($data): void + { + $this->anilist = new class($data) extends AbstractType { + public $client_id; + public $client_secret; + public $redirect_uri; + + public $access_token; + public $refresh_token; + + public $user_id; + public $username; + }; + } + + public function setCache ($data): void + { + $this->cache = new class($data) extends AbstractType { + public $driver; + public $connection; + public $options; + }; + } + + public function setDatabase ($data): void + { + $this->database = new class($data) extends AbstractType { + public $collection; + + public function setCollection ($data): void + { + $this->collection = new class($data) extends AbstractType { + public $type; + public $host; + public $user; + public $pass; + public $port; + public $database; + public $file; + }; + } + }; + } + + public function setRoute_config ($data): void + { + $this->route_config = new class($data) extends AbstractType { + public $asset_path; + public $default_list; + public $default_anime_list_path; + public $default_manga_list_path; + }; + } +} \ No newline at end of file