Console_CommandLine
[ class tree: Console_CommandLine ] [ index: Console_CommandLine ] [ all elements ]

Class: Console_CommandLine_Element

Source Location: /Console_CommandLine-1.2.0/Console/CommandLine/Element.php

Class Overview


Class that represent a command line element (an option, or an argument).


Author(s):

Version:

  • Release: 1.2.0

Copyright:

  • 2007 David JEAN LOUIS

Variables

Methods


Child classes:

Console_CommandLine_Argument
Class that represent a command line argument.
Console_CommandLine_Option
Class that represent a commandline option.

Inherited Variables

Inherited Methods


Class Details

[line 37]
Class that represent a command line element (an option, or an argument).


[ Top ]


Class Variables

$default =

[line 68]

The default value of the element if not provided on the command line.
  • Var: Default value of the option.
  • Access: public

Type:   mixed


[ Top ]

$description =

[line 61]

The element description.
  • Var: Element description
  • Access: public

Type:   string


[ Top ]

$help_name =

[line 54]

The name of variable displayed in the usage message, if no set it defaults to the "name" property.
  • Var: Element "help" variable name
  • Access: public

Type:   string


[ Top ]

$messages = array()

[line 97]

Custom errors messages for this element

This array is of the form:

  1.  <?php
  2.  array(
  3.      $messageName => $messageText,
  4.      $messageName => $messageText,
  5.      ...
  6.  );
  7.  ?>

If specified, these messages override the messages provided by the default message provider. For example:

  1.  <?php
  2.  $messages = array(
  3.      'ARGUMENT_REQUIRED' => 'The argument foo is required.',
  4.  );
  5.  ?>


Type:   array


[ Top ]

$name =

[line 46]

The element name.
  • Var: Element name
  • Access: public

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 110]

void __construct( [string $name = null], [array $params = array()])

Constructor.
  • Access: public

Overridden in child classes as:

Console_CommandLine_Option::__construct()
Constructor.

Parameters:

string   $name     The name of the element
array   $params     An optional array of parameters

[ Top ]

toString   [line 129]

string toString( )

Returns the string representation of the element.
  • Return: The string representation of the element
  • Todo: use __toString() instead
  • Access: public

Overridden in child classes as:

Console_CommandLine_Option::toString()
Returns the string representation of the option.

[ Top ]

validate   [line 142]

void validate( )

Validates the element instance and set it's default values.
  • Throws: Console_CommandLine_Exception
  • Access: public

Overridden in child classes as:

Console_CommandLine_Argument::validate()
Validates the argument instance.
Console_CommandLine_Option::validate()
Validates the option instance.

[ Top ]


Documentation generated on Thu, 25 Oct 2012 08:00:05 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.