* @license https://opensource.org/licenses/gpl-license.php GNU Public License * @link https://jcktrue.dks */ class App { protected Logger $logger; protected mixed $config; /** * Create a new instance providing a config file * * @param string $configFile Relative or full path to YML config. */ public function __construct(string $configFile) { $parser = new Yaml(); $this->config = $parser->parseFile($configFile); $logger = new Logger('app'); if (isset($this->config['log'])) { $logger->pushHandler(new StreamHandler($this->getConfig()['log'])); } $logger->info("Initialization complete"); $this->logger = $logger; } /** * Get the full configuration * * @return mixed Full configuration structure */ public function getConfig(): mixed { return $this->config; } /** * Get the logger instance. * * @return Logger Instance of logger */ public function getLogger(): Logger { return $this->logger; } }