Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

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

Interfaces

  • InputInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo

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), ));

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

Constructor.

Constructor.

Parameters

$definition
array
$definition An array of InputArgument and InputOption instance

Api

public
# setDefinition( array $definition )

Sets the definition of the input.

Sets the definition of the input.

Parameters

$definition
array
$definition The definition array

Api

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

Sets the InputArgument objects.

Sets the InputArgument objects.

Parameters

$arguments
Symfony\Component\Console\Input\InputArgument[]
$arguments An array of InputArgument objects

Api

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

Adds an array of InputArgument objects.

Adds an array of InputArgument objects.

Parameters

$arguments
Symfony\Component\Console\Input\InputArgument[]
$arguments An array of InputArgument objects

Api

public
# addArgument( Symfony\Component\Console\Input\InputArgument $argument )

Adds an InputArgument object.

Adds an InputArgument object.

Parameters

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

Throws

LogicException
When incorrect argument is given

Api

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
string|integer
$name The InputArgument name or position

Returns

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

Throws

InvalidArgumentException
When argument given doesn't exist

Api

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
string|integer
$name The InputArgument name or position

Returns

Boolean
true if the InputArgument object exists, false otherwise

Api

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

Api

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
Symfony\Component\Console\Input\InputOption[]
$options An array of InputOption objects

Api

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

Adds an array of InputOption objects.

Adds an array of InputOption objects.

Parameters

$options
Symfony\Component\Console\Input\InputOption[]
$options An array of InputOption objects

Api

public
# addOption( Symfony\Component\Console\Input\InputOption $option )

Adds an InputOption object.

Adds an InputOption object.

Parameters

$option
Symfony\Component\Console\Input\InputOption
$option An InputOption object

Throws

LogicException
When option given already exist

Api

public Symfony\Component\Console\Input\InputOption
# getOption( string $name )

Returns an InputOption by name.

Returns an InputOption by name.

Parameters

$name
string
$name The InputOption name

Returns

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

Throws

InvalidArgumentException
When option given doesn't exist

Api

public Boolean
# hasOption( string $name )

Returns true if an InputOption object exists by name.

Returns true if an InputOption object exists by name.

Parameters

$name
string
$name The InputOption name

Returns

Boolean
true if the InputOption object exists, false otherwise

Api

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

Api

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
string
$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
string
$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( )

Gets the synopsis.

Gets the synopsis.

Returns

string
The synopsis
public string
# asText( )

Returns a textual representation of the InputDefinition.

Returns a textual representation of the InputDefinition.

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.

Parameters

$asDom
Boolean
$asDom Whether to return a DOM or an XML string

Returns

string|DOMDocument
An XML string representing the InputDefinition
php-coveralls API documentation generated by ApiGen 2.8.0