Skip to content
Snippets Groups Projects

Resolve "Remove all use of GLOBALS"

Merged Stein Magne Bjorklund requested to merge 13-remove-all-use-of-globals into master
3 files
+ 81
1
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 37
0
<?php declare(strict_types=1);
namespace uib\ub\loadspeakr;
final class Configuration
{
private array $configs;
/**
* @throws \Exception
*/
public function __construct(array $conf)
{
if (count($conf) === 0) {
throw new \Exception(
'Configuration empty. Giving up.'
);
}
$this->configs['conf'] = $conf;
}
public function getConfigValue(string $type, string $key)
{
if (!isset($this->configs[$type][$key])) {
return '';
}
return $this->configs[$type][$key];
}
public function debugMode(): bool
{
return $this->configs['conf']['debug'];
}
}
Loading