Code Duplication    Length = 32-32 lines in 3 locations

src/Analysers/LibraryChanges.php 3 locations

@@ 123-154 (lines=32) @@
120
     * @param \PhpParser\Node\Name|string $name
121
     * @param int $line
122
     */
123
    private function handleClassName($name, $line = -1)
124
    {
125
        list($name, $line) = $this->prepareNameAndLine($name, $line);
126
        $info = $this->getLibraryInformation()->getClassInfo($name);
127
        if ($this->mode & self::MODE_ADDITION && $info['addition'] !== null) {
128
            $this->getResult()->addArbitraryRequirement(
129
                $info['addition'],
130
                $line,
131
                null,
132
                Reason::LIB_CLASS_ADDITION,
133
                ['className' => $name]
134
            );
135
        }
136
        if ($this->mode & self::MODE_DEPRECATION && $info['deprecation'] !== null) {
137
            $this->getResult()->addArbitraryLimit(
138
                $info['deprecation'],
139
                $line,
140
                null,
141
                Reason::LIB_CLASS_DEPRECATION,
142
                ['className' => $name]
143
            );
144
        }
145
        if ($this->mode & self::MODE_REMOVAL && $info['removal'] !== null) {
146
            $this->getResult()->addArbitraryLimit(
147
                $info['removal'],
148
                $line,
149
                null,
150
                Reason::LIB_CLASS_REMOVAL,
151
                ['className' => $name]
152
            );
153
        }
154
    }
155
156
    /**
157
     * @param \PhpParser\Node\Name|string $name
@@ 160-191 (lines=32) @@
157
     * @param \PhpParser\Node\Name|string $name
158
     * @param int $line
159
     */
160
    private function handleFunctionName($name, $line = -1)
161
    {
162
        list($name, $line) = $this->prepareNameAndLine($name, $line);
163
        $info = $this->getLibraryInformation()->getFunctionInfo($name);
164
        if ($this->mode & self::MODE_ADDITION && $info['addition'] !== null) {
165
            $this->getResult()->addArbitraryRequirement(
166
                $info['addition'],
167
                $line,
168
                null,
169
                Reason::LIB_FUNCTION_ADDITION,
170
                ['functionName' => $name]
171
            );
172
        }
173
        if ($this->mode & self::MODE_DEPRECATION && $info['deprecation'] !== null) {
174
            $this->getResult()->addArbitraryLimit(
175
                $info['deprecation'],
176
                $line,
177
                null,
178
                Reason::LIB_FUNCTION_DEPRECATION,
179
                ['functionName' => $name]
180
            );
181
        }
182
        if ($this->mode & self::MODE_REMOVAL && $info['removal'] !== null) {
183
            $this->getResult()->addArbitraryLimit(
184
                $info['removal'],
185
                $line,
186
                null,
187
                Reason::LIB_FUNCTION_REMOVAL,
188
                ['functionName' => $name]
189
            );
190
        }
191
    }
192
193
    /**
194
     * @param \PhpParser\Node\Name|string $name
@@ 197-228 (lines=32) @@
194
     * @param \PhpParser\Node\Name|string $name
195
     * @param int $line
196
     */
197
    private function handleConstantName($name, $line = -1)
198
    {
199
        list($name, $line) = $this->prepareNameAndLine($name, $line);
200
        $info = $this->getLibraryInformation()->getConstantInfo($name);
201
        if (($this->mode & self::MODE_ADDITION) && $info['addition'] !== null) {
202
            $this->getResult()->addArbitraryRequirement(
203
                $info['addition'],
204
                $line,
205
                null,
206
                Reason::LIB_CONSTANT_ADDITION,
207
                ['constantName' => $name]
208
            );
209
        }
210
        if (($this->mode & self::MODE_DEPRECATION) && $info['deprecation'] !== null) {
211
            $this->getResult()->addArbitraryLimit(
212
                $info['deprecation'],
213
                $line,
214
                null,
215
                Reason::LIB_CONSTANT_DEPRECATION,
216
                ['constantName' => $name]
217
            );
218
        }
219
        if (($this->mode & self::MODE_REMOVAL) && $info['removal'] !== null) {
220
            $this->getResult()->addArbitraryLimit(
221
                $info['removal'],
222
                $line,
223
                null,
224
                Reason::LIB_CONSTANT_REMOVAL,
225
                ['constantName' => $name]
226
            );
227
        }
228
    }
229
230
    /**
231
     * @inheritdoc