HummingBirdAnimeClient/src/AnimeClient/Types/Config.php

130 lines
3.0 KiB
PHP
Raw Normal View History

<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu to manage anime and manga watch lists
*
2021-02-04 11:57:01 -05:00
* PHP version 8
*
* @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net>
2021-01-13 01:52:03 -05:00
* @copyright 2015 - 2021 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
2020-12-10 17:06:50 -05:00
* @version 5.2
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Types;
class Config extends AbstractType {
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
// Config files/namespaces
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
2020-04-28 12:24:12 -04:00
public ?Config\Anilist $anilist;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?Config\Cache $cache;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?Config\Database $database;
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
// Settings in config.toml
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
2021-02-23 15:38:29 -05:00
public string $root; // Path to app root
2020-04-28 12:24:12 -04:00
public ?string $asset_path; // Path to public folder for urls
2019-12-09 13:13:31 -05:00
/**
2020-12-11 14:26:54 -05:00
* The PHP timezone
*/
public string $timezone = '';
2019-12-09 13:13:31 -05:00
/**
* Default Anime list status page, values are listed in
* Aviat\AnimeClient\API\Enum\AnimeWatchingStatus\Title
*/
2020-04-28 12:24:12 -04:00
public ?string $default_anime_list_path;
2019-12-09 13:13:31 -05:00
/**
* The list to redirect to from the root url
* 'anime' or 'manga'
2019-12-09 13:13:31 -05:00
*
* @var string|null
2019-12-09 13:13:31 -05:00
*/
2020-04-28 12:24:12 -04:00
public ?string $default_list;
2019-12-09 13:13:31 -05:00
/**
* Default Manga list status page, values are listed in
* Aviat\AnimeClient\API\Enum\MangaReadingStatus\Title
*/
2020-04-28 12:24:12 -04:00
public ?string $default_manga_list_path;
2019-12-09 13:13:31 -05:00
/**
* Default list view type
* 'cover_view' or 'list_view'
2019-12-09 13:13:31 -05:00
*/
2020-04-28 12:24:12 -04:00
public ?string $default_view_type;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?string $kitsu_username;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public bool $secure_urls = TRUE;
2019-12-09 13:13:31 -05:00
public string|bool $show_anime_collection = FALSE;
2019-12-09 13:13:31 -05:00
public string|bool $show_manga_collection = FALSE;
2019-12-09 13:13:31 -05:00
/**
* CSS theme: light, dark, or auto-switching
* 'auto', 'light', or 'dark'
2019-12-09 13:13:31 -05:00
*/
2020-12-11 14:26:54 -05:00
public ?string $theme = 'auto';
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?string $whose_list;
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
// Application config
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
/**
* @var array
*/
2020-04-28 12:24:12 -04:00
public array $menus;
2019-12-09 13:13:31 -05:00
/**
* @var array
*/
2020-04-28 12:24:12 -04:00
public array $routes;
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
// Generated config values
2019-12-09 13:13:31 -05:00
// ------------------------------------------------------------------------
2020-04-28 12:24:12 -04:00
public ?string $asset_dir; // Path to public folder for local files
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?string $base_config_dir;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?string $config_dir;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?string $data_cache_path;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?string $img_cache_path;
2019-12-09 13:13:31 -05:00
2020-04-28 12:24:12 -04:00
public ?string $view_path;
public function setAnilist (mixed $data): void
{
$this->anilist = Config\Anilist::from($data);
}
public function setCache (mixed $data): void
{
$this->cache = Config\Cache::from($data);
}
public function setDatabase (mixed $data): void
{
$this->database = Config\Database::from($data);
}
}