Detects and sets "concatenated flag" type arguments.
@param string $argument The argument string.
@return boolean
164108
private function detectConcatFlag($argument)
    {
        if (substr($argument, 0, 1) === '-') {
            for ($i = 1; isset($argument[$i]); $i++) {
                $this->flags->push($argument[$i]);
            }
            return true;
        }
        return false;
    }
277047
protected function argumentList(&$out)
    {
        $s = $this->count;
        $this->matchChar('(');

        $args = [];

        while ($this->keyword($var)) {
            if ($this->matchChar('=') && $this->expression($exp)) {
                $args[] = [Type::T_STRING, '', [$var . '=']];
                $arg = $exp;
            } else {
                break;
            }

            $args[] = $arg;

            if (! $this->matchChar(',')) {
                break;
            }

            $args[] = [Type::T_STRING, '', [', ']];
        }

        if (! $this->matchChar(')') || !$args) {
            $this->seek($s);

            return false;
        }

        $out = $args;

        return true;
    }
1253373
private function isFlagEnabled($flag): bool
    {
        $flag = $this->parseFlag($flag);

        return $flag === ($this->flags & $flag);
    }
818631
private function resolveArgument($argument)
    {
        if ($argument instanceof Definition) {
            return $this->resolveDefinition($argument);
        }

        if ($argument instanceof Reference) {
            return $this->resolveReference($argument);
        }

        if (is_array($argument)) {
            return $this->resolveArguments($argument);
        }

        return $argument;
    }
1275587
protected function hasInputArgument($argument, $input)
    {
        return $input->hasArgument($argument) && null !== $input->getArgument($argument);
    }
312731
public function has($flag)
    {
        $values = $this->getValuesFromFlagOrEnum($flag);

        if (empty($values)) {
            return false;
        }

        foreach ($values as $value) {
            if (!(bool) ($this->value & $value)) {
                return false;
            }
        }

        return true;
    }
397811
private function detectOptions($argument)
    {
        if (substr($argument, 0, 2) === '--') {
            $name = substr($argument, 2);
            $value = '';
            if (strpos($name, '=')) {
                list($name, $value) = explode('=', $argument, 2);
            }
            $this->options->put(ltrim($name, '-'), trim($value, '"'));
            return true;
        }
        return false;
    }
531901
protected function buildArguments($arguments)
    {
        if (!is_string($arguments)) {
            $arguments = (array) $arguments;
            $arguments = implode(' ', $arguments);
        }

        return $arguments;
    }
1281460
public function setFlag(string $flag): bool
    {
        $result = \imap_setflag_full($this->resource->getStream(), (string) $this->getNumber(), $flag, \ST_UID);

        $this->clearHeaders();

        return $result;
    }
985014
public static function isLongCode( $arg )
    {
        $retVal = ( strlen( $arg ) > 2 ) && ( '-' === $arg[ 0 ] && '-' === $arg[ 1 ] );
        
        if ( 2 === strlen( $arg ) )
        {
            return $retVal;
        }
        
        if ( ( !is_bool( $arg ) && !Util::validIndex( 2, $arg ) ) || '-' === $arg[ 2 ] )
        {
            throw new CommandException( 'Unknown option type [ ' . $arg . ' ]' );
        }
        
        return $retVal;
    }
769466
protected function processArgumentValue(stdClass $argument) {
		if (! isset($argument->value)) {
			throw new Exceptions\InvalidConfig('Argument of type "value" must contain a "value" property');
		}

		if (is_array($argument->value)) {
			return $this->processArguments($argument->value);
		}

		return $argument->value;
	}
390708
public static function validate($argument, $argumentName = null)
    {
        // DEBUG
        //echo "Argument: $argument\n";
        //echo "Argument name: $argumentName\n";

        if ($argument === null) {
            self::throwException($argument, $argumentName);
        }

        if (gettype($argument) != 'string') {
            self::throwException($argument, $argumentName);
        }

        if (gettype($argument) == 'string' && trim($argument) == '') {
            self::throwException($argument, $argumentName);
        }

        if (!in_array($argument, BlockCypherCoinSymbolConstants::COIN_SYMBOL_LIST())) {
            self::throwException($argument, $argumentName);
        }

        return true;
    }
280435
private function getMethodArgument($argument)
    {
        $arg = '__unknown__';
        if ($argument instanceof PyStringNode) {
            $arg = 'PyStringNode $string';
        } elseif ($argument instanceof TableNode) {
            $arg = 'TableNode $table';
        }

        return $arg;
    }
707220
public function appendArgument($argument) {
    if (is_scalar($argument)) {
      $argument = Node::fromValue($argument);
    }

    if ($argument instanceof ExpressionNode) {
      /** @var Node $argument */
      $this->arguments->appendItem($argument);
    }
    else {
      throw new \InvalidArgumentException();
    }

    return $this;
  }
95015
protected function processArguments($arguments) {
		$processedArgs = [];
		
		foreach ($arguments as $key => $argument) {
			if (! isset($argument->type)) {
				throw new Exceptions\InvalidConfig('Argument definition must contain a "type" property"');
			}
			
			$type = strtolower(trim($argument->type));
			
			if ($type === 'value') {
				$processedArgs[$key] = $this->processArgumentValue($argument);
				continue;
			}
			
			if ($type === 'service') {
				$processedArgs[$key] = $this->processArgumentService($argument);
				continue;
			}
			
			if ($type === 'parameter') {
				$processedArgs[$key] = $this->processArgumentParameter($argument);
				continue;
			}
			
			throw new Exceptions\InvalidConfig('Unknown type of argument: "' . $type . '"');
		}
		
		return $processedArgs;
	}
914307
protected function isFlagSet($options, $flag)
    {
        $options = abs( (int) $options);
        $flag = abs( (int) $flag);
        return (($options & $flag) === $flag);
    }
1368600
protected function makeRequired($argument)
    {
        if ($argument instanceof TypeInterface) {
            $argument = new NonNullType($argument);
        } elseif(is_array($argument)) {
            $argument['type'] = new NonNullType($argument['type']);
        }

        return $argument;
    }