????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.28 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/b8009/php-5.6.22/scripts/dev/generate-phpt/src/setup/ |
Upload File : |
<?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]);
}
}
?>