protected function getResolvedStacks(InputInterface $input) { $stacks = Finder::find((array) $input->getArgument('stack'), $this->getStacks()); $except = $input->getOption('except'); if (!empty($except)) { if (($key = array_search($except, $stacks)) !== false) { unset($stacks[$key]); } } return $stacks; }
/** * Resolve wildcard * * @param $stackName * @return mixed * @throws \Exception */ public function resolveWildcard($stackName) { if (strpos($stackName, '*') === false) { return $stackName; } $helper = new \StackFormation\Helper(); $stacks = Finder::find($stackName, array_keys($this->getStacksFromApi())); if (count($stacks) == 0) { throw new \Exception("No matching stack found for '{$stackName}'"); } elseif (count($stacks) > 1) { throw new \Exception("Found more than one matching stack for '{$stackName}'."); } return end($stacks); }