/** * Given a "-"-based argument, this will parse out the information, pulling out and validating any/all ShortIdentifiers. * If it is a single or clustered FlagParameter, it will set the flag(s) to true. * If it is a NamedParameter, then if a value is specified using "=", then the value will be applied to the ShortIdentifier, otherwise, it will set $intCurrentValueIndex to the ValueIndex of the ShortIdentifier. * @param string $strArgument the full "-"-based argument * @param integer $intCurrentValueIndex the new current ValueIndex that should be evaluated (if applicable) * @return string any error message (if any) */ protected function ParseShortIdentifier($strArgument, &$intCurrentValueIndex) { // Parse out the leading "-" $strArgument = substr($strArgument, 1); // Clean Out and Verify the ShortIdentifier $chrShortIdentifier = substr($strArgument, 0, 1); try { $chrShortIdentifier = QCliParameterProcessor::CleanShortIdentifier($chrShortIdentifier); } catch (QCallerException $objExc) { return 'invalid argument "' . $chrShortIdentifier . '"'; } // Get the ValueIndex if (array_key_exists($chrShortIdentifier, $this->chrShortIdentifierArray)) { $intValueIndex = $this->chrShortIdentifierArray[$chrShortIdentifier]; } else { return 'invalid argument "' . $chrShortIdentifier . '"'; } // See if this is a Flag- or a Named-Parameter if (array_key_exists($intValueIndex, $this->blnFlagArray)) { // Flag! This also may be clustered, so go through all of the letters in the argument and set the flag value to true return $this->ParseShortIdentifierCluster($strArgument); } else { // NamedParameter -- Do we Have a Value? $strArgument = substr($strArgument, 1); if (strlen($strArgument)) { // Yes -- Set it // Take out any leading "=" if (QString::FirstCharacter($strArgument) == '=') { $strArgument = substr($strArgument, 1); } // Set the Value try { $this->mixValueArray[$intValueIndex] = QCliParameterProcessor::CleanValue($strArgument, $this->intParameterTypeArray[$intValueIndex]); } catch (QCallerException $objExc) { return $objExc->GetMessage(); } } else { // No -- so let's update the Currently-processing ValueIndex $intCurrentValueIndex = $intValueIndex; } } // Success - no errors return null; }