| @@ 137-152 (lines=16) @@ | ||
| 134 | * Store the data from a @default annotation in our argument or option store, |
|
| 135 | * as appropriate. |
|
| 136 | */ |
|
| 137 | protected function processDefaultTag($tag) |
|
| 138 | { |
|
| 139 | if (!$this->pregMatchNameAndDescription((string)$tag->getDescription(), $match)) { |
|
| 140 | return; |
|
| 141 | } |
|
| 142 | $variableName = $match['name']; |
|
| 143 | $defaultValue = $this->interpretDefaultValue($match['description']); |
|
| 144 | if ($this->commandInfo->arguments()->exists($variableName)) { |
|
| 145 | $this->commandInfo->arguments()->setDefaultValue($variableName, $defaultValue); |
|
| 146 | return; |
|
| 147 | } |
|
| 148 | $variableName = $this->commandInfo->findMatchingOption($variableName); |
|
| 149 | if ($this->commandInfo->options()->exists($variableName)) { |
|
| 150 | $this->commandInfo->options()->setDefaultValue($variableName, $defaultValue); |
|
| 151 | } |
|
| 152 | } |
|
| 153 | ||
| 154 | /** |
|
| 155 | * Store the data from a @usage annotation in our example usage list. |
|
| @@ 122-137 (lines=16) @@ | ||
| 119 | * Store the data from a @default annotation in our argument or option store, |
|
| 120 | * as appropriate. |
|
| 121 | */ |
|
| 122 | protected function processDefaultTag($tag) |
|
| 123 | { |
|
| 124 | if (!$tag->hasWordAndDescription($matches)) { |
|
| 125 | throw new \Exception('Could not determine parameter name from tag ' . (string)$tag); |
|
| 126 | } |
|
| 127 | $variableName = $matches['word']; |
|
| 128 | $defaultValue = $this->interpretDefaultValue($matches['description']); |
|
| 129 | if ($this->commandInfo->arguments()->exists($variableName)) { |
|
| 130 | $this->commandInfo->arguments()->setDefaultValue($variableName, $defaultValue); |
|
| 131 | return; |
|
| 132 | } |
|
| 133 | $variableName = $this->commandInfo->findMatchingOption($variableName); |
|
| 134 | if ($this->commandInfo->options()->exists($variableName)) { |
|
| 135 | $this->commandInfo->options()->setDefaultValue($variableName, $defaultValue); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Store the data from a @usage annotation in our example usage list. |
|