/**
  * Add Option Definition
  *
  * @param OptionDefinition $optionDefinition
  *
  * @return void
  */
 public function add(OptionDefinition $optionDefinition)
 {
     $this->options[$optionDefinition->getLabel()] = $optionDefinition;
     if (($shortName = $optionDefinition->getShortName()) !== null) {
         $this->map[$shortName] = $optionDefinition;
     }
     if (($longName = $optionDefinition->getLongName()) !== null) {
         $this->map[$longName] = $optionDefinition;
     }
 }
示例#2
0
 /**
  * @inheritDoc
  */
 public function __toString()
 {
     $names = [];
     if (($longName = $this->optionDefinition->getLongName()) !== null) {
         $names[] = $longName;
     }
     if (($shortName = $this->optionDefinition->getShortName()) !== null) {
         $names[] = $shortName;
     }
     return 'option(' . implode(' | ', $names) . ')::' . $this->optionDefinition->getType();
 }
示例#3
0
 public function hasOption(OptionDefinition $definition)
 {
     return isset($this->options[$definition->getLabel()]);
 }