Esempio n. 1
0
 /**
  * Execute this command
  * @param array $arguments Array of commandline arguments
  */
 public function execute(array $arguments)
 {
     try {
         $oldComponent = new \Cx\Core\Core\Model\Entity\ReflectionComponent($arguments[3], $arguments[2]);
         $newComponent = new \Cx\Core\Core\Model\Entity\ReflectionComponent($arguments[5], $arguments[4]);
     } catch (\Exception $ex) {
         throw new CommandException('Invalid arguments passed. Please check the parameters or run help command to see the options');
     }
     if ($oldComponent == $newComponent) {
         $this->interface->show('Nothing to do');
         return;
     }
     if (!$oldComponent->exists()) {
         throw new CommandException('No such component "' . $oldComponent->getName() . '" of type ' . $oldComponent->getType());
     }
     $toBeCustomized = false;
     if (isset($arguments[6])) {
         $toBeCustomized = $arguments[6] == 'customized';
     }
     if (!$this->interface->yesNo('This comes without any warranty. Are your sure you want to copy the component?')) {
         return;
     }
     $oldComponent->copy($newComponent->getName(), $newComponent->getType(), $toBeCustomized);
     $this->interface->show('Done');
 }
Esempio n. 2
0
 /**
  * Execute this command
  * @param array $arguments Array of commandline arguments
  */
 public function execute(array $arguments)
 {
     $oldComponent = new \Cx\Core\Core\Model\Entity\ReflectionComponent($arguments[3], $arguments[2]);
     $newComponent = new \Cx\Core\Core\Model\Entity\ReflectionComponent($arguments[5], $arguments[4]);
     if ($oldComponent == $newComponent) {
         $this->interface->show('Nothing to do');
         return;
     }
     if (!$oldComponent->exists()) {
         throw new CommandException('No such component "' . $oldComponent->getName() . '" of type ' . $oldComponent->getType());
     }
     $toBeCustomized = false;
     if (isset($arguments[6])) {
         $toBeCustomized = $arguments[6] == 'customized';
     }
     if (!$this->interface->yesNo('This comes without any warranty. Are your sure you want to move the component?')) {
         return;
     }
     $oldComponent->move($newComponent->getName(), $newComponent->getType(), $toBeCustomized);
     $this->interface->show('Done');
 }