silverorange Code


Site.SiteCommandLineArgumentParameter
/Site/SiteCommandLineArgumentParameter.php at line 13

Class SiteCommandLineArgumentParameter

SwatObject
└─SiteObject
└─SiteCommandLineArgumentParameter

public class SiteCommandLineArgumentParameter
extends SiteObject

A parameter for a command line argument

Copyright:
2006 silverorange
License:
http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
See Also:
SiteCommandLineArgument::addParameter()

Field Summary
protected mixed

$default

The default value of this parameter.

protected string

$error_message

protected string

$type

The type of this parameter.

Constructor Summary

SiteCommandLineArgumentParameter(string type, string error_message, mixed default)

Creates a new command line argument parameter.

Method Summary
mixed

getDefault()

Gets the default value of this parameter.

string

getErrorMessage()

Gets the error message text of this parameter.

boolean

hasDefault()

Whether or not a default value is specified for this parameter.

boolean

validate(mixed value)

Checks a value to see if it is the correct type for this parameter.

Field Detail

/Site/SiteCommandLineArgumentParameter.php at line 38

default

protected mixed $default

The default value of this parameter


/Site/SiteCommandLineArgumentParameter.php at line 22

error_message

protected string $error_message

See Also:
SiteCommandLineArgumentParameter::getErrorMessage()

/Site/SiteCommandLineArgumentParameter.php at line 31

type

protected string $type

The type of this parameter

Type must be one of 'int', 'integer', 'double', 'float', or 'string'.


Constructor Detail

/Site/SiteCommandLineArgumentParameter.php at line 55

SiteCommandLineArgumentParameter

public SiteCommandLineArgumentParameter(string type, string error_message, mixed default)

Creates a new command line argument parameter

Parameters:
type - the type of the parameter. Must be one of 'int', 'integer', 'double', 'float', or 'string'.
error_message - a message displayed when the user omits a required parameter or the user specifies a parameter value of the wrong type.
default - optional default value. If a default value is specified and the user does not specify the parameter value, the default value is used.

Method Detail

/Site/SiteCommandLineArgumentParameter.php at line 99

getDefault

public mixed getDefault()

Gets the default value of this parameter

Returns:
the default value of this parameter.

/Site/SiteCommandLineArgumentParameter.php at line 72

getErrorMessage

public string getErrorMessage()

Gets the error message text of this parameter

Returns:
a message displayed when the user omits a this required parameter or when the user specifies value for this parameter of the wrong type.

/Site/SiteCommandLineArgumentParameter.php at line 86

hasDefault

public boolean hasDefault()

Whether or not a default value is specified for this parameter

Returns:
true if a default value is specified for this parameter and false if it is not.

/Site/SiteCommandLineArgumentParameter.php at line 115

validate

public boolean validate(mixed value)

Checks a value to see if it is the correct type for this parameter

Parameters:
value - the value to check.
Returns:
true if the value is of the correct type for this parameter and false if it is not.

silverorange Code