示例#1
0
 /**
  * Handles the "build" command.
  *
  * @param Args $args The console arguments.
  *
  * @return int The status code.
  */
 public function handle(Args $args)
 {
     $target = $args->getArgument('target');
     if (!in_array($target, self::$targets)) {
         throw new RuntimeException(sprintf('Invalid build target "%s". Expected one of: "%s"', $target, implode('", "', self::$targets)));
     }
     if ('all' === $target || 'factory' === $target) {
         $this->factoryManager->autoGenerateFactoryClass();
     }
     if ('all' === $target || 'repository' === $target) {
         $this->repoManager->clearRepository();
         $this->repoManager->buildRepository();
     }
     if ('all' === $target || 'discovery' === $target) {
         $this->discoveryManager->clearDiscovery();
         $this->discoveryManager->buildDiscovery();
     }
     return 0;
 }