Beispiel #1
0
 /**
  * Returns the newly minted importer.
  *
  * This method must be called last, and only once.
  *
  * @return \Devour\Importer\ImporterInterface
  *   The newly configured importer.
  *
  * @throws \LogicException
  *   Thrown if called more than once.
  */
 public function build()
 {
     if ($this->hasBeenExecuted) {
         throw new \LogicException('Builders can only be used once.');
     }
     $this->hasBeenExecuted = TRUE;
     // Hello old faithful.
     if (!$this->importer) {
         $this->setImporter(new Importer());
     }
     $this->replayCommands();
     if (!$this->importer->getLogger()) {
         $this->doSetLogger(new NullLogger());
     }
     $this->importer->validate();
     // Since this is potentially a long running process, we need to make an
     // effort to clean up after ourselves.
     $importer = $this->importer;
     unset($this->importer, $this->commands, $this->clients);
     return $importer;
 }