/**
* Adds a long option value.
*
* @throws InvalidOptionException When option given doesn't exist
* @throws InvalidOptionException When a required value is missing
*/ privatefunctionaddLongOption(string $name, mixed $value): void { if(!$this->definition->hasOption($name)){
if('-' ===($optionToken[1] ?? ' ')){ // long option name
return$this->definition->hasOption($optionName) ? $this->definition->getOption($optionName) : null; }
// short option name
return$this->definition->hasShortcut($optionName[0]) ? $this->definition->getOptionForShortcut($optionName[0]) : null; }
/**
* The token of the cursor, or the last token if the cursor is at the end of the input.
*/ privatefunctiongetRelevantToken(): string { return$this->tokens[$this->isCursorFree() ? $this->currentIndex - 1 : $this->currentIndex]; }
/**
* Whether the cursor is "free" (i.e. at the end of the input preceded by a space).
*/
if('-' ===($optionToken[1] ?? ' ')){ // long option name
return$this->definition->hasOption($optionName) ? $this->definition->getOption($optionName) : null; }
// short option name
return$this->definition->hasShortcut($optionName[0]) ? $this->definition->getOptionForShortcut($optionName[0]) : null; }
/**
* The token of the cursor, or the last token if the cursor is at the end of the input.
*/ privatefunctiongetRelevantToken(): string { return$this->tokens[$this->isCursorFree() ? $this->currentIndex - 1 : $this->currentIndex]; }
/**
* Whether the cursor is "free" (i.e. at the end of the input preceded by a space).
*/
return$parseOptions; }
/**
* Parses a short option.
*/ privatefunctionparseShortOption(string $token): void { $name = substr($token, 1);
/**
* Adds a long option value.
*
* @throws InvalidOptionException When option given doesn't exist
* @throws InvalidOptionException When a required value is missing
*/ privatefunctionaddLongOption(string $name, mixed $value): void { if(!$this->definition->hasOption($name)){