dbConn = $dbConn; $this->siteInfo = new SiteInfo; $this->startTemplating(); $this->contacts = new Contacts\Contacts($dbConn); $this->projects = new Projects\Projects($dbConn); $this->sshKeys = new SSHKeys\SSHKeys($dbConn); } public function getDatabase(): IDbConnection { return $this->dbConn; } public function getSiteInfo(): SiteInfo { return $this->siteInfo; } public function getContacts(): Contacts\Contacts { return $this->contacts; } public function getProjects(): Projects\Projects { return $this->projects; } public function getSSHKeys(): SSHKeys\SSHKeys { return $this->sshKeys; } public function getTemplating(): SasaeEnvironment { return $this->templating; } public function startTemplating(): void { $isDebug = Environment::isDebug(); $this->templating = new SasaeEnvironment( MKI_DIR_TEMPLATES, cache: $isDebug ? null : ['Makai', GitInfo::hash(true)], debug: $isDebug, ); $this->templating->addGlobal('globals', [ 'siteInfo' => $this->siteInfo, 'assetsInfo' => AssetsInfo::fromCurrent(), ]); } public function createRouting(): RoutingContext { $routingCtx = new RoutingContext($this->templating); $routingCtx->registerDefaultErrorPages(); $routingCtx->register(new HomeRoutes($this->templating, $this->contacts, $this->projects)); $routingCtx->register(new Contacts\ContactsRoutes($this->templating, $this->contacts)); $routingCtx->register(new Projects\ProjectsRoutes($this->templating, $this->projects)); $routingCtx->register(new AssetsRoutes($this->siteInfo)); $routingCtx->register(new NowListeningRoutes($this->templating)); $routingCtx->register(new Whois\WhoisRoutes($this->templating)); $routingCtx->register(new SSHKeys\SSHKeysRoutes($this->sshKeys)); $routingCtx->register(new Tools\AsciiRoutes($this->templating)); $routingCtx->register(new Tools\RandomStringRoutes); return $routingCtx; } }