com phpruntests: Added comments.: src/configuration/rtCommandLineOptions.php

From: Date: Mon, 11 May 2009 21:28:16 +0000
Subject: com phpruntests: Added comments.: src/configuration/rtCommandLineOptions.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66482@lists.php.net to get a copy of this message
Commit: 1c3f1ee6a38ae842d49443886d90de0a61309755 Author: Stefan Priebsch <spriebsch@php.net> Mon, 11 May 2009 21:28:16 +0000 Parents: 00c7aff852ae9ce675c179a43564b59ea315f04f Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=1c3f1ee6a38ae842d49443886d90de0a61309755 Log: Added comments. Changed paths: M src/configuration/rtCommandLineOptions.php Diff: diff --git a/src/configuration/rtCommandLineOptions.php b/src/configuration/rtCommandLineOptions.php index 30d699f..4e70140 100644 --- a/src/configuration/rtCommandLineOptions.php +++ b/src/configuration/rtCommandLineOptions.php @@ -10,7 +10,7 @@ class rtCommandLineOptions { /** - * + * @var array */ protected $shortOptions = array( 'n', @@ -22,6 +22,9 @@ class rtCommandLineOptions 'z', //parallel - run out of obvious letters ); + /** + * @var array + */ protected $shortOptionsWithArgs = array( 'l', 'r', @@ -33,6 +36,9 @@ class rtCommandLineOptions 's', ); + /** + * @var array + */ protected $longOptions = array( 'verbose', 'help', @@ -52,6 +58,9 @@ class rtCommandLineOptions 'no-clean', ); + /** + * @var array + */ protected $longOptionsWithArgs = array( 'html', 'temp-source', @@ -59,24 +68,54 @@ class rtCommandLineOptions '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 @@ class rtCommandLineOptions * --{longOption} * --{longOptionWithArg} {arg} * file name|directory name + * + * @param array $argv Command line arguments + * @return void */ public function parseCommandLineOptions($argv) { @@ -123,10 +165,11 @@ class rtCommandLineOptions } } - /** * 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 @@ class rtCommandLineOptions /** + * Returns the value of given option. * + * @param string $option option name */ public function getOption($option) { @@ -172,7 +217,10 @@ class rtCommandLineOptions /** - * 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 @@ class rtCommandLineOptions /** - * 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.qa (#66482) next »