Implement front end location/time/weather etc

This commit is contained in:
Dale Davies
2022-02-08 23:05:56 +00:00
parent 36f44fb266
commit 6d5366147f
19 changed files with 275 additions and 150 deletions

View File

@@ -35,9 +35,7 @@ class Config {
'wwwroot',
'cachebypass',
'cachedir',
'noindex',
'latlong',
'owmapikey'
'noindex'
];
public function __construct() {
@@ -69,22 +67,24 @@ class Config {
*/
private function config_params_missing(): bool {
return !!array_diff(
array_keys($this->config->toArray()),
array_merge(
array_keys(self::BASE_APPLICATION_PATHS),
self::CONFIG_PARAMS
));
),
array_keys($this->config->toArray()),
);
}
/**
* Retrieves the config parameter provided in $key, first checks for its
* existence.
*
* @param string $key The config parameter required.
* @param string $key The requested config parameter key.
* @param bool $strict Throw exception if requested param is not found, or return null.
* @return mixed The selected value from the configuration array.
*/
public function get(string $key): mixed {
if (!$this->config->has($key)) {
public function get(string $key, $strict = true): mixed {
if (!$this->config->has($key) && $strict === true) {
throw new Exception('Config key does not exist... ('.$key.')');
}
return $this->config->get($key);