/** * @param ArgContainer $argContainer */ private function processArgContainer(ArgContainer $argContainer) { $mappings = $this->buildArgMappings(); foreach ($argContainer->getAllOptions() as $argName => $argValue) { $handled = false; foreach ($mappings as $mapping) { if (in_array($argName, $mapping['arguments'])) { $mapping['action']($argValue); $handled = true; break; } } if (!$handled) { throw new UnrecognizedOptionException('Unrecognized option: ' . $argName); } } foreach ($argContainer->getStrayArguments() as $strayArgument) { $this->pathsToCheck[] = $strayArgument; } if ($this->action == self::ACTION_UNKNOWN) { $this->action = empty($this->pathsToCheck) ? self::ACTION_HELP : self::ACTION_CHECK; } }