PHP 인터페이스 Webmozart\Console\Api\Args\RawArgs

Implementations of this class represent the arguments that a user passes when calling the console. For example: $ console server add --port 80 localhost In this case, the raw arguments contain the tokens: * "server" * "add" * "--port" * "80" * "localhost" With an implementation of {@link ArgsParser} and a configured {@link ArgsFormat}, the {@link RawArgs} instance can be converted into an {@link Args} instance: php $format = ArgsFormat::build() ->addCommandName(new CommandName('server')) ->addCommandName(new CommandName('add')) ->addOption(new Option('port', 'p', Option::VALUE_REQUIRED | Option::INTEGER)) ->addArgument(new Argument('host', Argument::REQUIRED)) ->getFormat(); $args = $parser->parseArgs($rawArgs, $format); The {@link Args} instance can be used to access the options and arguments of a command in a convenient way.
부터: 1.0
저자: Bernhard Schussek ([email protected])
파일 보기 프로젝트 열기: webmozart/console 0 사용 예제들

공개 메소드들

메소드 설명
getScriptName ( ) : string | null Returns the PHP script as it was called on the console.
getTokens ( ) : string[] Returns the tokens of the console arguments.
hasToken ( string $token ) : boolean Returns whether the console arguments contain a given token.
toString ( boolean $scriptName = true ) : string Returns the console arguments as string.

메소드 상세

getScriptName() 공개 메소드

Returns the PHP script as it was called on the console.
public getScriptName ( ) : string | null
리턴 string | null The script name or null if no script name is available.

getTokens() 공개 메소드

Returns the tokens of the console arguments.
public getTokens ( ) : string[]
리턴 string[] The argument tokens.

hasToken() 공개 메소드

Returns whether the console arguments contain a given token.
public hasToken ( string $token ) : boolean
$token string The token to look for.
리턴 boolean Returns `true` if the arguments contain the token and `false` otherwise.

toString() 공개 메소드

Returns the console arguments as string.
public toString ( boolean $scriptName = true ) : string
$scriptName boolean Whether to include the script name in the output.
리턴 string The arguments as string.