public function compile(IConfigNode $root) { /** * @var $resource IResource */ foreach ($this->resourceList as $resource) { list($resource, $required) = $resource; if ($required === true && !$resource->isAvailable()) { throw new CompilerException(sprintf('Requested config resource [%s] is not available.', $resource->getUri())); } $this->eventBus->emit(new ConfigResourceEvent($this, $root->addNodeList($this->handle($resource), true), $resource)); } $this->eventBus->emit(new CompiledEvent($this, $root)); return $root; }
/** * helper method, that treat parameter in "parameters" section as dir and provides aditional checks * * @param string $name * @param bool|true $isDir * @param bool|false $writable * * @return false|string if dir did not passed checks, return false, otherwise dirname */ public function getDir($name, $isDir = true, $writable = false) { $this->compile(); if (($dir = $this->parameters->query("\${$name}Dir")) === null) { return false; } $dir = FileUtils::normalize($dir); if (($isDir === true || $writable === true) && !is_dir($dir)) { return false; } if ($writable === true && !is_writable($dir)) { return false; } return $dir; }