/** * Register Knit Component * @throws BootstrapException */ protected function registerKnit() { // Container has Knit component, must be defined in config if (!property_exists($this->config->app, "knit")) { throw BootstrapException::knitNode(); } // Bootstrap knit $this->knit = $this->container->get("Knit"); // Compiler path if (!property_exists($this->config->app->knit, "compilerPath")) { throw BootstrapException::knitCompilerPath(); } try { $this->knit->setCompilerPath($this->rootPath . self::DS . $this->config->app->knit->compilerPath); // Caching if (property_exists($this->config->app->knit, "caching")) { /** @var $this Kernel */ switch ($this->config->app->knit->caching) { case "static": case 1: $this->knit->setCachePath($this->getDisk("cache"))->setCaching(Knit::CACHE_STATIC); break; case "dynamic": case 2: $this->knit->setCachePath($this->getDisk("cache"))->setCaching(Knit::CACHE_DYNAMIC); break; } } } catch (\ComelyException $e) { throw new BootstrapException(__METHOD__, $e->getMessage(), $e->getCode()); } }