@param IArgument $argument
@param array $groupedArgs
@param bool $strict

@return array
@throws MissingArgumentValueException
341442
public function matchArgument(IArgument $argument, array $groupedArgs, $strict = true) {
        $arg = null;

        if (array_has($groupedArgs, 'arguments')) {
            if ($argument->isSingle()) {
                $arg = array_shift($groupedArgs['arguments']);
            } else if ($argument->isMultiple()) {
                $arg = array_get($groupedArgs, 'arguments');
                array_set($groupedArgs, 'arguments', []);
            }
        }

        if ($argument->isRequired() && $strict && ($arg === null || $arg === [])) {
            throw new MissingArgumentValueException(s(
                'Missing argument value "%s".', $argument->getName()
            ));
        }

        $argument->setValue($arg);

        return $groupedArgs;
    }
280694
protected function matchBooleanOption(IOption $option, array $groupedArgs, $strict) {
        if (array_has($groupedArgs, $option->getNameOrAlias())) {
            $values = array_take($groupedArgs, $option->getNameOrAlias());

            if ($values === []) {
                $option->setValue(true);
            } else {
                $value = array_pop($values);

                if (array_contains([1, '1', true, 'true'], $value)) {
                    $option->setValue(true);
                } else if (array_contains([0, '0', false, 'false'], $value)) {
                    $option->setValue(false);
                } else if ($strict) {
                    throw new InvalidOptionValueException(s(
                        'Boolean option "%s" expects one of these values: 0, 1, true, false.',
                        $option->getNameOrAlias()
                    ));
                }
            }
        }

        return $groupedArgs;
    }
172147
def _get_aggregate_args(self, item, key):
    
    if not key in ('args', 'mandatoryArgs'):
      raise TypeError('key must be "args" or "mandatoryArgs", got {}').format(key)
    dependencies = list(getattr(item, key))
    if hasattr(item, 'conditions'):
      dependencies += [name for negated, name in map(is_negated, item.conditions)]
    args = set()
    while dependencies:
      name = dependencies.pop()
      if name in args:
        continue
      args.add(name)
      # if this is a condition, expand its dependencies
      c = self.conditions.get(name, None)
      if c is None:
        continue
      dependencies += [dependency for dependency in getattr(c, key)
                                              if dependency not in args]
    return args
902271
public function addArgument(IStackableArgument $argument)
    {
        if ($argument instanceof ISubKeyedStackableArgument) {
            $key = $argument->getSubKey();
            if (isset($this->args[$key])) {
                throw new \InvalidArgumentException("Can't override the subkey: $key");
            }
        } else {
            $key = $this->stackKey();
        }

        $this->args[$key][$argument->getSubKey()] = $argument;

        return $this;
    }
1085080
protected function assertArgumentRequirement($key, $regex, $arguments)
    {
        if (substr($regex, -1) === '+' && !array_key_exists($key, $arguments)) {
            throw new RouteException(sprintf('Missing value for argument "%s" in route "%s"', $key, $this->pattern));
        }
    }
920846
protected function matchIncrementalOption(IOption $option, array $groupedArgs, $strict) {
        if (array_has($groupedArgs, $option->getNameOrAlias())) {
            $values = array_take($groupedArgs, $option->getNameOrAlias());
            $optionCount = array_get($groupedArgs, s('options.%s', $option->getNameOrAlias()), 0);
            $valueProvided = false;

            foreach ($values as $value) {
                if (is_numeric($value)) {
                    $option->setValue(intval($value));
                    $valueProvided = true;
                }
            }

            if ( ! $valueProvided) {
                $option->setValue($optionCount);
            }
        }

        return $groupedArgs;
    }
575557
function argParser (arg, argName, strictType) {
  let parsedArg
  let argType = getItType(arg)
  const errFormatter = (errString, argType) => {
    return `${errString}\n|argName| = |${argName}|\n|type| = |${argType}|\n|arg| = |#{arg}|`
  }

  switch (argType) {
    case 'STRING':
      try {
        parsedArg = ['REGEXP', RegExp(arg)]
      } catch (e) {
        throw SyntaxError(errFormatter('cant compile this String to RegExp', argType))
      }
      break
    case 'REGEXP':
      parsedArg = ['REGEXP', arg]
      break
    case 'FUNCTION':
      parsedArg = ['FUNCTION', arg]
      break
    default:
      throw TypeError(errFormatter('argument must be String, RegExp or Function, but got', argType))
  }

  if (strictType && parsedArg[0] !== strictType.toUpperCase()) {
    throw TypeError(errFormatter(`argument must be ${strictType}, but got`, argType))
  }
  return parsedArg
}
223591
@Override
	public int parseArgument(Options opts, String[] args, int i) throws BadCommandLineException {
		initLoggerIfNecessary(opts);

		int recognized = 0;

		String arg = args[i];
		logger.trace("Argument[" + i + "] = " + arg);

		if (arg.equals(getArgumentName(ConfigurationOption.APPLY_PLURAL_FORM.optionName()))) {
			globalConfiguration.setApplyPluralForm(true);
			return 1;
		}
		else if ((recognized = parseArgument(args, i, ConfigurationOption.CONTROL)) == 0
		            && (recognized = parseArgument(args, i, ConfigurationOption.SUMMARY)) == 0
		            && (recognized = parseArgument(args, i, ConfigurationOption.COLLECTION_INTERFACE)) == 0 // longer option name comes first
		            && (recognized = parseArgument(args, i, ConfigurationOption.COLLECTION_IMPLEMENTATION)) == 0
		            && (recognized = parseArgument(args, i, ConfigurationOption.INSTANTIATION_MODE)) == 0) {
			if (arg.startsWith(getArgumentName(""))) {
				throw new BadCommandLineException("Invalid argument " + arg);
			}
		}

		return recognized;
	}
1300343
public function addArguments(?string $arguments = null)
    {
        $args = [];
        preg_match_all('/(?P<argument>\w+):(?P<value>[\w+\-]+)/', $arguments, $matches);
        if (isset($matches['argument'])) {
            foreach ($matches['argument'] as $key => $argKey) {
                if (isset($matches['value'][$key])) {
                    $args[$argKey] = $matches['value'][$key];
                }
            }
        }
        $this->arguments = $args;
    }
794070
private function inlineArguments(ContainerBuilder $container, array $arguments, $isRoot = false)
    {
        foreach ($arguments as $k => $argument) {
            if ($isRoot) {
                $this->currentId = $k;
            }
            if (is_array($argument)) {
                $arguments[$k] = $this->inlineArguments($container, $argument);
            } elseif ($argument instanceof Reference) {
                if (!$container->hasDefinition($id = (string) $argument)) {
                    continue;
                }

                if ($this->isInlineableDefinition($id, $definition = $container->getDefinition($id))) {
                    $this->compiler->addLogMessage($this->formatter->formatInlineService($this, $id, $this->currentId));

                    if ($definition->isShared()) {
                        $arguments[$k] = $definition;
                    } else {
                        $arguments[$k] = clone $definition;
                    }
                }
            } elseif ($argument instanceof Definition) {
                $argument->setArguments($this->inlineArguments($container, $argument->getArguments()));
                $argument->setMethodCalls($this->inlineArguments($container, $argument->getMethodCalls()));
                $argument->setProperties($this->inlineArguments($container, $argument->getProperties()));

                $configurator = $this->inlineArguments($container, array($argument->getConfigurator()));
                $argument->setConfigurator($configurator[0]);

                $factory = $this->inlineArguments($container, array($argument->getFactory()));
                $argument->setFactory($factory[0]);
            }
        }

        return $arguments;
    }
673224
private function formatArrayArgument(Argument $argument) : string
    {
        $arrayArgumentTextOne = $argument->getName() . '1';
        $arrayArgumentTextN = $argument->getName() . 'N';

        if ($argument->isOptional()) {
            $arrayArgumentTextOne = "[$arrayArgumentTextOne]";
            $arrayArgumentTextN = "[$arrayArgumentTextN]";
        }

        return "$arrayArgumentTextOne...$arrayArgumentTextN";
    }
87673
public function validate( $value, $predicate, $argument = NULL )
	{
		if( !method_exists( $this->validator, $predicate ) )
			throw new BadMethodCallException( 'Predicate "'.$predicate.'" is not defined.' );
		try
		{
			return $this->validator->$predicate( $value, $argument );
		}
		catch( InvalidArgumentException $e )
		{
			return false;
		}
		catch( Exception $e )
		{
			throw $e;
		}
	}
1118805
@Nonnull
  public IMPLTYPE arg (@Nonnegative final int nIndex, @Nonnull final IJSExpression aArgument)
  {
    ValueEnforcer.notNull (aArgument, "Argument");
    m_aArgs.add (nIndex, aArgument);
    return _thisAsT ();
  }
1003222
public function group(array $args) {
        $groupedArgs = [
            'arguments' => [],
            'options' => [],
        ];

        $option = 'arguments';

        foreach ($args as $arg) {
            if ($this->isOptionNameOrAlias($arg)) {
                $option = $arg;

                if ( ! array_has($groupedArgs, $option)) {
                    $groupedArgs[$option] = [];
                    $groupedArgs['options'][$option] = 1;
                } else {
                    $groupedArgs['options'][$option] += 1;
                }
            } else {
                $groupedArgs[$option][] = $arg;
            }
        }

        return $groupedArgs;
    }
286107
function parse(string $value, \CharlotteDunois\Livia\Commands\Context $context, ?\CharlotteDunois\Livia\Arguments\Argument $arg = null) {
        $groups = $this->client->registry->findGroups($value);
        if(\count($groups) > 0) {
            return $groups[0];
        }
        
        return null;
    }
543980
private function adaptArgument(Argument $argument)
    {
        $mode = null;

        if ($argument->isMultiValued()) {
            $mode |= InputArgument::IS_ARRAY;
        }

        if ($argument->isOptional()) {
            $mode |= InputArgument::OPTIONAL;
        }

        if ($argument->isRequired()) {
            $mode |= InputArgument::REQUIRED;
        }

        return new InputArgument($argument->getName(), $mode, $argument->getDescription(), $argument->getDefaultValue());
    }
208770
private function resolveArguments(
        array $arguments,
        ValueResolverInterface $resolver,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        GenerationContext $context
    ): array {
        $scope = $fixtureSet->getParameters()->toArray();

        $argumentPosition = 1;
        foreach ($arguments as $index => $argument) {
            if ($argument instanceof ValueInterface) {
                try {
                    $result = $resolver->resolve($argument, $fixture, $fixtureSet, $scope, $context);
                } catch (ResolutionThrowable $throwable) {
                    throw UnresolvableValueDuringGenerationExceptionFactory::createFromResolutionThrowable($throwable);
                }

                list($fixtureSet, $value) = [$result->getSet(), $result->getValue()];

                $arguments[$index] = $value;

                if (is_int($index)) {
                    $scope[$argumentPosition] = $value;
                } else {
                    $scope[$index] = $value;
                }

                $argumentPosition++;
            }
        }

        return [$arguments, $fixtureSet];
    }