Code Duplication    Length = 16-16 lines in 2 locations

src/Parser/Internal/AbstractCommandDocBlockParser.php 1 location

@@ 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.

src/Parser/Internal/BespokeDocBlockParser.php 1 location

@@ 119-134 (lines=16) @@
116
     * Store the data from a @default annotation in our argument or option store,
117
     * as appropriate.
118
     */
119
    protected function processDefaultTag($tag)
120
    {
121
        if (!$tag->hasWordAndDescription($matches)) {
122
            throw new \Exception('Could not determine parameter name from tag ' . (string)$tag);
123
        }
124
        $variableName = $matches['word'];
125
        $defaultValue = $this->interpretDefaultValue($matches['description']);
126
        if ($this->commandInfo->arguments()->exists($variableName)) {
127
            $this->commandInfo->arguments()->setDefaultValue($variableName, $defaultValue);
128
            return;
129
        }
130
        $variableName = $this->commandInfo->findMatchingOption($variableName);
131
        if ($this->commandInfo->options()->exists($variableName)) {
132
            $this->commandInfo->options()->setDefaultValue($variableName, $defaultValue);
133
        }
134
    }
135
136
    /**
137
     * Store the data from a @usage annotation in our example usage list.