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

Class: PHP_DocBlockGenerator_GetoptPlus

Source Location: /PHP_DocBlockGenerator-1.1.2/PHP/DocBlockGenerator/GetoptPlus.php

Class Overview


Getopt extension


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2007 Michel Corne

Methods


Inherited Variables

Inherited Methods


Class Details

[line 54]
Getopt extension

Generate short options, long options, usage/help automaticly



[ Top ]


Method Detail

alignLines   [line 136]

array alignLines( array $lines, string $firstLineAddon, [integer $paddingLength = 0])

Align a set of lines

Additional data is added to the first line. The other lines are padded and aligned to the first one.

  • Return: the aligned lines
  • Access: public

Parameters:

array   $lines   —  the set of lines
string   $firstLineAddon   —  the additional data to add to the first line
integer   $paddingLength   —  the padding length

[ Top ]

getopt   [line 176]

array getopt( [array $config = array()], [boolean $toLongNames = true], [boolean $asKeys = true], [integer $version = 2])

Gets the options and parameters from the command arguments

Extracts the command arguments. Tidies the options. Builds the help/usage text.

  • Return: the options and parameters
  • Access: public

Parameters:

array   $config   —  the command configuration
boolean   $toLongNames   —  Converts options names to long names if true, e.g. "align", or to short names if false, e.g. "A", default is true
boolean   $asKeys   —  return options with the names used as array keys if true, or leave them as returned by Console_Getopt::doGetopt(), default is true
integer   $version   —  Console_Getopt::doGetopt version

[ Top ]

setHelp   [line 207]

array setHelp( array $config, string $command)

Set the help/usage text
  • Return: the help/usage text
  • Access: public

Parameters:

array   $config   —  the command configuration
string   $command   —  the command name

[ Top ]

setOptions   [line 229]

array setOptions( array $options)

Sets the options help text section
  • Return: the options help text section
  • Access: public

Parameters:

array   $options   —  the options descriptions

[ Top ]

setUsage   [line 269]

array setUsage( array $usages, string $command, array $options, array $parameters)

Sets the usage help text section
  • Return: the usage help text section
  • Access: public

Parameters:

array   $usages   —  the usages descriptions
string   $command   —  the command name
array   $options   —  the options descriptions
array   $parameters   —  the parameters descriptions

[ Top ]

tidyArgs   [line 308]

array tidyArgs( array $options, [boolean $toLongNames = true], [boolean $asKeys = true])

Tidies the command arguments
  • Return: the tidy options arguments
  • Access: public

Parameters:

array   $options   —  the options arguments
boolean   $toLongNames   —  Converts options names to long names if true, e.g. "align", or to short names if false, e.g. "A", default is true
boolean   $asKeys   —  return options with the names used as array keys if true, or leave them as returned by Console_Getopt::doGetopt(), default is true

[ Top ]

tidyArray   [line 354]

array tidyArray( array $array, [boolean $tidyString = true])

Tidies an array

Makes an array if passed as a string. Optionally forces the values to strings if there are not.

  • Return: the tidy array
  • Access: public

Parameters:

array   $array   —  the array
boolean   $tidyString   —  forces the values to string if true, or leave them untouched if false

[ Top ]

tidyOptions   [line 371]

array tidyOptions( array $options)

Tydies the options
  • Return: the tidy options
  • Access: public

Parameters:

array   $options   —  the options descriptions

[ Top ]

tidyString   [line 420]

string tidyString( string $string)

Tidies a string

Retains only the first value if passed as an array.

  • Return: the tidy string
  • Access: public

Parameters:

string   $string   —  the string

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:46:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.