public function __construct(array $arguments, array $options)
{
$argumentsLength = count($arguments);
$index = 1;
if ($argumentsLength < 2 || !$options) {
return;
}
while ($index < $argumentsLength) {
$char1 = isset($arguments[$index][0]) ? $arguments[$index][0] : null;
$char2 = isset($arguments[$index][1]) ? $arguments[$index][1] : null;
if ($char1 === '-' && $char2) {
$option = $arguments[$index];
$argument = $index + 1 < $argumentsLength ? $arguments[$index + 1] : null;
if ($char2 === '-') {
if (!isset($arguments[$index][2])) {
$index++;
break;
} elseif (!$this->parseLongOption($option, $argument, $options, $index)) {
break;
}
} elseif (!$this->parseShortOption($option, $argument, $options, $index)) {
break;
}
} else {
$this->nonOptions[] = $arguments[$index++];
}
}
}