diff options
| author | Kalle Sommer Nielsen <kalle@php.net> | 2018-07-23 17:38:26 +0200 |
|---|---|---|
| committer | Kalle Sommer Nielsen <kalle@php.net> | 2018-07-23 17:38:26 +0200 |
| commit | ba138a3746b3077ebe5b7356b5b49f21cfc30438 (patch) | |
| tree | 3e2ebf3ee00efde3e7a223aab64a3ea090b33e2d /scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php | |
| parent | b1864b017860b69f0b20a75fad790c9ab7a4fd1c (diff) | |
| download | php-git-ba138a3746b3077ebe5b7356b5b49f21cfc30438.tar.gz | |
Removed the generated-tests library, this is a left Zöe's phpruntests repository it seems and never fully implemented. The only times this part of the code has been touched throughout the years has been minor PRs and entire php-src grep commits.
If anything this belongs to the phpruntests.git repository.
Diffstat (limited to 'scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php')
| -rw-r--r-- | scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php b/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php deleted file mode 100644 index 0e4d878bab..0000000000 --- a/scripts/dev/generate-phpt/src/setup/gtCommandLineOptions.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -/** - * Parse command line options - * - */ -class gtCommandLineOptions { - - protected $shortOptions = array( - 'b', - 'e', - 'v', - 'h', - ); - - protected $shortOptionsWithArgs = array( - 'c', - 'm', - 'f', - 'i', - 's', - 'x', - 'k', - ); - - protected $options; - - protected function isShortOption($arg) - { - return (substr($arg, 0, 1) == '-') && (substr($arg, 1, 1) != '-'); - } - - public function isValidOptionArg($array, $index) { - if (!isset($array[$index])) - { - return false; - } - return substr($array[$index], 0, 1) != '-'; - } - - - public function parse($argv) - { - if(count($argv) < 2) { - throw new gtMissingOptionsException('Command line options are required'); - } - - for ($i=1; $i<count($argv); $i++) { - - if ($this->isShortOption($argv[$i])) { - $option = substr($argv[$i], 1); - } else { - throw new gtUnknownOptionException('Unrecognised command line option ' . $argv[$i]); - } - - if (!in_array($option, array_merge($this->shortOptions, $this->shortOptionsWithArgs))) - { - throw new gtUnknownOptionException('Unknown option ' . $argv[$i]); - } - - if (in_array($option, $this->shortOptions)) { - $this->options[$option] = true; - continue; - } - - if (!$this->isValidOptionArg($argv, $i + 1)) - { - throw new gtMissingArgumentException('Missing argument for command line option ' . $argv[$i]); - } - - $i++; - $this->options[$option] = $argv[$i]; - } - } - - /** - * - */ - public function getOption($option) - { - if (!isset($this->options[$option])) { - return false; - } - return $this->options[$option]; - } - - - /** - * Check whether an option exists - */ - public function hasOption($option) - { - return isset($this->options[$option]); - } - - -} -?>
\ No newline at end of file |
