Overview

Namespaces

  • Evenement
  • None
  • Peridot
    • Console
    • Core
    • Reporter
    • Runner
    • Scope
    • Test
  • Symfony
    • Component
      • Console
        • Command
        • Descriptor
        • Event
        • Exception
        • Formatter
        • Helper
        • Input
        • Logger
        • Output
        • Question
        • Style
        • Tester
        • Tests
          • Command
          • Descriptor
          • Fixtures
          • Formatter
          • Helper
          • Input
          • Logger
          • Output
          • Style
          • Tester

Classes

  • ArgvInput
  • ArrayInput
  • Input
  • InputArgument
  • InputDefinition
  • InputOption
  • StringInput

Interfaces

  • InputAwareInterface
  • InputInterface
  • Overview
  • Namespace
  • Class

Class ArgvInput

ArgvInput represents an input coming from the CLI arguments.

Usage: $input = new ArgvInput();

By default, the $_SERVER['argv'] array is used for the input values.

This can be overridden by explicitly passing the input values in the constructor: $input = new ArgvInput($_SERVER['argv']);

If you pass it yourself, don't forget that the first element of the array is the name of the running application.

When passing an argument to the constructor, be sure that it respects the same rules as the argv one. It's almost always better to use the StringInput when you want to provide your own input.

Symfony\Component\Console\Input\Input implements Symfony\Component\Console\Input\InputInterface
Extended by Symfony\Component\Console\Input\ArgvInput

Direct known subclasses

Symfony\Component\Console\Input\StringInput
Namespace: Symfony\Component\Console\Input
Author: Fabien Potencier fabien@symfony.com
See: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
See: http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02
Located at Input/ArgvInput.php
Methods summary
public
# __construct( array $argv = null, Symfony\Component\Console\Input\InputDefinition $definition = null )

Constructor.

Constructor.

Parameters

$argv
An array of parameters from the CLI (in the argv format)
$definition
A InputDefinition instance

Overrides

Symfony\Component\Console\Input\Input::__construct()
protected
# setTokens( array $tokens )
protected
# parse( )

Processes command line arguments.

Processes command line arguments.

public string
# getFirstArgument( )

Returns the first argument from the raw parameters (not parsed).

Returns the first argument from the raw parameters (not parsed).

Returns

string
The value of the first argument or null otherwise
public boolean
# hasParameterOption( string|array $values )

Returns true if the raw parameters (not parsed) contain a value.

Returns true if the raw parameters (not parsed) contain a value.

Parameters

$values
The values to look for in the raw parameters (can be an array)

Returns

boolean
true if the value is contained in the raw parameters
public mixed
# getParameterOption( string|array $values, mixed $default = false )

Returns the value of a raw option (not parsed).

Returns the value of a raw option (not parsed).

Parameters

$values
The value(s) to look for in the raw parameters (can be an array)
$default
The default value to return if no result is found

Returns

mixed
The option value
public string
# __toString( )

Returns a stringified representation of the args passed to the command.

Returns a stringified representation of the args passed to the command.

Returns

string
Methods inherited from Symfony\Component\Console\Input\Input
bind(), escapeToken(), getArgument(), getArguments(), getOption(), getOptions(), hasArgument(), hasOption(), isInteractive(), setArgument(), setInteractive(), setOption(), validate()
Properties inherited from Symfony\Component\Console\Input\Input
$arguments, $definition, $interactive, $options
Peridot API documentation generated by ApiGen