/**
  * Executes solver operation.
  *
  * @param RepositoryInterface $repo      repository in which to check
  * @param OperationInterface  $operation operation instance
  */
 public function execute(RepositoryInterface $repo, OperationInterface $operation)
 {
     $method = $operation->getJobType();
     $this->{$method}($repo, $operation);
 }
 /**
  * Get the package from a given operation
  *
  * Is needed because update operations don't have a getPackage method
  *
  * @access protected
  * @param OperationInterface $operation The operation
  * @return PackageInterface The package of the operation
  */
 protected function getPackageFromOperation(OperationInterface $operation)
 {
     if ($operation->getJobType() === 'update') {
         return $operation->getTargetPackage();
     }
     return $operation->getPackage();
 }
 /**
  * Executes solver operation.
  *
  * @param   OperationInterface  $operation  operation instance
  */
 public function execute(OperationInterface $operation)
 {
     $method = $operation->getJobType();
     $this->{$method}($operation);
 }
Beispiel #4
0
 /**
  * Add job by operation type.
  *
  * @param OperationInterface $operation
  * @param \Closure $install
  * @param \Closure $update
  * @param \Closure $uninstall
  */
 protected static function addJobByOperationType(OperationInterface $operation, \Closure $install, \Closure $uninstall, \Closure $update = null)
 {
     switch ($operation->getJobType()) {
         case 'install':
             self::getContainer()->addJob($install($operation->getPackage()));
             break;
         case 'uninstall':
             self::getContainer()->addJob($uninstall($operation->getPackage()));
             break;
         case 'update':
             $update = $update ?: $install;
             self::getContainer()->addJob($update($operation->getTargetPackage()));
             break;
     }
 }