/** * Formats an option * * @param Option $option The option to format * @return string The formatted option */ private function formatOption(Option $option) { $text = "[--{$option->getName()}"; if ($option->valueIsOptional()) { $text .= "=" . $option->getDefaultValue(); } if ($option->getShortName() !== null) { $text .= "|-{$option->getShortName()}"; } $text .= "]"; return $text; }
/** * Gets the option names as a formatted string * * @param Option $option The option to convert to text * @return string The option names as text */ private function getOptionNames(Option $option) { $optionNames = "--{$option->getName()}"; if ($option->getShortName() !== null) { $optionNames .= "|-{$option->getShortName()}"; } return $optionNames; }
/** * @inheritdoc */ public function addOption(Option $option) { $this->options[$option->getName()] = $option; return $this; }