cvs: phpruntests /src/configuration rtCommandLineOptions.php

From: Date: Mon, 11 May 2009 21:28:16 +0000
Subject: cvs: phpruntests /src/configuration rtCommandLineOptions.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-57723@lists.php.net to get a copy of this message
spriebsch Mon May 11 21:28:16 2009 UTC Modified files: /phpruntests/src/configuration rtCommandLineOptions.php Log: Added comments. http://cvs.php.net/viewvc.cgi/phpruntests/src/configuration/rtCommandLineOptions.php?r1=1.3&r2=1.4&diff_format=u Index: phpruntests/src/configuration/rtCommandLineOptions.php diff -u phpruntests/src/configuration/rtCommandLineOptions.php:1.3 phpruntests/src/configuration/rtCommandLineOptions.php:1.4 --- phpruntests/src/configuration/rtCommandLineOptions.php:1.3 Fri Apr 24 08:41:25 2009 +++ phpruntests/src/configuration/rtCommandLineOptions.php Mon May 11 21:28:16 2009 @@ -10,7 +10,7 @@ class rtCommandLineOptions { /** - * + * @var array */ protected $shortOptions = array( 'n', @@ -22,6 +22,9 @@ 'z', //parallel - run out of obvious letters ); + /** + * @var array + */ protected $shortOptionsWithArgs = array( 'l', 'r', @@ -33,6 +36,9 @@ 's', ); + /** + * @var array + */ protected $longOptions = array( 'verbose', 'help', @@ -52,6 +58,9 @@ 'no-clean', ); + /** + * @var array + */ protected $longOptionsWithArgs = array( 'html', 'temp-source', @@ -59,24 +68,54 @@ 'set-timeout', ); + /** + * @var array + */ protected $options = array(); + /** + * @var array + */ protected $testFilename = array(); + /** + * Constructs the object + */ public function __construct() { } + /** + * Parse the command line options + * + * @param array $argv Command line arguments + * @return void + */ public function parse($argv) { $this->parseCommandLineOptions($this->stripSpaces($argv)); } + /** + * Returns true when argument is a short option, + * i.e. begins with -. To differentiate from long option (--) + * we also look at the second character, which may not be a - character. + * + * @param string $arg Single command line argument + * @return bool + */ protected function isShortOption($arg) { return (substr($arg, 0, 1) == '-') && (substr($arg, 1, 1) != '-'); } + /** + * Returns true when argument is a long option, + * i.e. begins with -- + * + * @param string $arg Single command line argument + * @return bool + */ protected function isLongOption($arg) { return substr($arg, 0, 2) == '--'; @@ -89,6 +128,9 @@ * --{longOption} * --{longOptionWithArg} {arg} * file name|directory name + * + * @param array $argv Command line arguments + * @return void */ public function parseCommandLineOptions($argv) { @@ -123,10 +165,11 @@ } } - /** * Checks to make sure that the arument following does not begin with "-" - * @param string - argument + * + * @param array $array arguments + * @param string $index array index * @return bool */ public function isValidOptionArg($array, $index) @@ -159,7 +202,9 @@ /** + * Returns the value of given option. * + * @param string $option option name */ public function getOption($option) { @@ -172,7 +217,10 @@ /** - * Check whether an option exists + * Check whether an option exists. + * + * @param string $option option name + * @return bool */ public function hasOption($option) { @@ -181,7 +229,9 @@ /** - * Return the array containing file names or directory names to be tested + * Return the array containing file names or directory names to be tested. + * + * @return string */ public function getTestFilename() {

« previous php.cvs (#57723) next »