저자: Arne Blankerts (arne@blankerts.de)
예제 #1
0
파일: Factory.php 프로젝트: sakshika/ATM
 public function getInstanceFor(EnrichConfig $enrichCfg)
 {
     $name = $enrichCfg->getType();
     if (!isset($this->enrichers[$name])) {
         throw new FactoryException("Enricher '{$name}' is not registered.", FactoryException::UnknownEnricher);
     }
     if (isset($this->configs[$name])) {
         $cfg = new $this->configs[$name]($enrichCfg->getGeneratorConfig(), $enrichCfg->getEnrichNode());
     } else {
         $cfg = $enrichCfg;
     }
     if ($this->enrichers[$name] instanceof FactoryInterface) {
         return $this->enrichers[$name]->getInstanceFor($name, $cfg);
     }
     return new $this->enrichers[$name]($cfg);
 }
예제 #2
0
 public function __construct(EnrichConfig $config)
 {
     $this->enrichers = array_keys($config->getGeneratorConfig()->getActiveEnrichSources());
     $this->version = $config->getVersion();
 }