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 InputDefinition

A InputDefinition represents a set of valid command line arguments and options.

Usage: $definition = new InputDefinition(array( new InputArgument('name', InputArgument::REQUIRED), new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), ));

Direct known subclasses

Peridot\Console\InputDefinition
Namespace: Symfony\Component\Console\Input
Author: Fabien Potencier fabien@symfony.com
Located at Input/InputDefinition.php
Methods summary
public
# __construct( array $definition = array() )

Constructor.

Constructor.

Parameters

$definition
An array of InputArgument and InputOption instance
public
# setDefinition( array $definition )

Sets the definition of the input.

Sets the definition of the input.

Parameters

$definition
The definition array
public
# setArguments( Symfony\Component\Console\Input\InputArgument[] $arguments = array() )

Sets the InputArgument objects.

Sets the InputArgument objects.

Parameters

$arguments
An array of InputArgument objects
public
# addArguments( Symfony\Component\Console\Input\InputArgument[] $arguments = array() )

Adds an array of InputArgument objects.

Adds an array of InputArgument objects.

Parameters

$arguments
An array of InputArgument objects
public
# addArgument( Symfony\Component\Console\Input\InputArgument $argument )

Adds an InputArgument object.

Adds an InputArgument object.

Parameters

$argument
An InputArgument object

Throws

Symfony\Component\Console\Exception\LogicException
When incorrect argument is given
public Symfony\Component\Console\Input\InputArgument
# getArgument( string|integer $name )

Returns an InputArgument by name or by position.

Returns an InputArgument by name or by position.

Parameters

$name
The InputArgument name or position

Returns

Symfony\Component\Console\Input\InputArgument
An InputArgument object

Throws

Symfony\Component\Console\Exception\InvalidArgumentException
When argument given doesn't exist
public boolean
# hasArgument( string|integer $name )

Returns true if an InputArgument object exists by name or position.

Returns true if an InputArgument object exists by name or position.

Parameters

$name
The InputArgument name or position

Returns

boolean
true if the InputArgument object exists, false otherwise
public Symfony\Component\Console\Input\InputArgument[]
# getArguments( )

Gets the array of InputArgument objects.

Gets the array of InputArgument objects.

Returns

Symfony\Component\Console\Input\InputArgument[]
An array of InputArgument objects
public integer
# getArgumentCount( )

Returns the number of InputArguments.

Returns the number of InputArguments.

Returns

integer
The number of InputArguments
public integer
# getArgumentRequiredCount( )

Returns the number of required InputArguments.

Returns the number of required InputArguments.

Returns

integer
The number of required InputArguments
public array
# getArgumentDefaults( )

Gets the default values.

Gets the default values.

Returns

array
An array of default values
public
# setOptions( Symfony\Component\Console\Input\InputOption[] $options = array() )

Sets the InputOption objects.

Sets the InputOption objects.

Parameters

$options
An array of InputOption objects
public
# addOptions( Symfony\Component\Console\Input\InputOption[] $options = array() )

Adds an array of InputOption objects.

Adds an array of InputOption objects.

Parameters

$options
An array of InputOption objects
public
# addOption( Symfony\Component\Console\Input\InputOption $option )

Adds an InputOption object.

Adds an InputOption object.

Parameters

$option
An InputOption object

Throws

Symfony\Component\Console\Exception\LogicException
When option given already exist
public Symfony\Component\Console\Input\InputOption
# getOption( string $name )

Returns an InputOption by name.

Returns an InputOption by name.

Parameters

$name
The InputOption name

Returns

Symfony\Component\Console\Input\InputOption
A InputOption object

Throws

Symfony\Component\Console\Exception\InvalidArgumentException
When option given doesn't exist
public boolean
# hasOption( string $name )

Returns true if an InputOption object exists by name.

Returns true if an InputOption object exists by name.

This method can't be used to check if the user included the option when executing the command (use getOption() instead).

Parameters

$name
The InputOption name

Returns

boolean
true if the InputOption object exists, false otherwise
public Symfony\Component\Console\Input\InputOption[]
# getOptions( )

Gets the array of InputOption objects.

Gets the array of InputOption objects.

Returns

Symfony\Component\Console\Input\InputOption[]
An array of InputOption objects
public boolean
# hasShortcut( string $name )

Returns true if an InputOption object exists by shortcut.

Returns true if an InputOption object exists by shortcut.

Parameters

$name
The InputOption shortcut

Returns

boolean
true if the InputOption object exists, false otherwise
public Symfony\Component\Console\Input\InputOption
# getOptionForShortcut( string $shortcut )

Gets an InputOption by shortcut.

Gets an InputOption by shortcut.

Parameters

$shortcut
the Shortcut name

Returns

Symfony\Component\Console\Input\InputOption
An InputOption object
public array
# getOptionDefaults( )

Gets an array of default values.

Gets an array of default values.

Returns

array
An array of all default values
public string
# getSynopsis( boolean $short = false )

Gets the synopsis.

Gets the synopsis.

Parameters

$short
Whether to return the short version (with options folded) or not

Returns

string
The synopsis
public string
# asText( )

Returns a textual representation of the InputDefinition.

Returns a textual representation of the InputDefinition.

Deprecated

since version 2.3, to be removed in 3.0.

Returns

string
A string representing the InputDefinition
public string|DOMDocument
# asXml( boolean $asDom = false )

Returns an XML representation of the InputDefinition.

Returns an XML representation of the InputDefinition.

Deprecated

since version 2.3, to be removed in 3.0.

Parameters

$asDom
Whether to return a DOM or an XML string

Returns

string|DOMDocument
An XML string representing the InputDefinition
Peridot API documentation generated by ApiGen