public function getInstanceFor(BuildConfig $buildCfg) { $name = $buildCfg->getEngine(); if (!isset($this->engines[$name])) { throw new FactoryException("Engine '{$name}' is not registered.", FactoryException::UnknownEngine); } if (isset($this->configs[$name])) { $cfg = new $this->configs[$name]($buildCfg->getGeneratorConfig(), $buildCfg->getBuildNode()); } else { $cfg = $buildCfg; } if ($this->engines[$name] instanceof FactoryInterface) { return $this->engines[$name]->getInstanceFor($name, $cfg); } return new $this->engines[$name]($cfg); }
public function __construct(BuildConfig $config) { $this->outputDir = $config->getOutputDirectory(); }