template = new Template(templateDir: dirname(path: __DIR__, levels: 2) . '/templates/'); $this->addressBook = new AddressBook(template: $this->template); $this->router = new Router(); } public function get(string $className): object { return match ($className) { 'App\Controller\AddressBook' => $this->addressBook, 'App\Service\Router' => $this->router, //default => throw new Exception(message: "Missing class definition: $class") default => die("Missing class definition: $className") }; } }