Ejemplo n.º 1
0
 /**
  * Returns the packages that should be displayed for the given console
  * arguments.
  *
  * @param Args $args The console arguments.
  *
  * @return PackageCollection The packages.
  */
 private function getSelectedPackages(Args $args)
 {
     $states = $this->getSelectedStates($args);
     $expr = Expr::true();
     $envs = array();
     if ($states !== PackageState::all()) {
         $expr = $expr->andMethod('getState', Expr::in($states));
     }
     if ($args->isOptionSet('installer')) {
         $expr = $expr->andMethod('getInstallInfo', Expr::method('getInstallerName', Expr::same($args->getOption('installer'))));
     }
     if ($args->isOptionSet('prod')) {
         $envs[] = Environment::PROD;
     }
     if ($args->isOptionSet('dev')) {
         $envs[] = Environment::DEV;
     }
     if (count($envs) > 0) {
         $expr = $expr->andMethod('getInstallInfo', Expr::method('getEnvironment', Expr::in($envs)));
     }
     return $this->packageManager->findPackages($expr);
 }
Ejemplo n.º 2
0
 /**
  * Returns the packages that should be displayed for the given console
  * arguments.
  *
  * @param Args $args The console arguments.
  *
  * @return PackageCollection The packages.
  */
 private function getSelectedPackages(Args $args)
 {
     $states = $this->getSelectedStates($args);
     $expr = Expr::true();
     if ($states != PackageState::all()) {
         $expr = $expr->andIn($states, Package::STATE);
     }
     if ($args->isOptionSet('installer')) {
         $expr = $expr->andSame($args->getOption('installer'), Package::INSTALLER);
     }
     return $this->packageManager->findPackages($expr);
 }