* @license https://opensource.org/licenses/gpl-license.php GNU Public License * @link https://jcktrue.dks */ class App { protected Logger $logger; protected array $config; /** * Create a new instance providing a config file * * @param string $configFile Relative or full path to YML config. */ function __construct(string $configFile) { $this->config = Yaml::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 array Full configuration structure */ function getConfig() : array { return $this->config; } /** * Get the logger instance. * * @return Logger Instance of logger */ function getLogger() : Logger { return $this->logger; } }