Code Duplication    Length = 15-16 lines in 2 locations

src/POData/HttpProcessUtility.php 2 locations

@@ 237-251 (lines=15) @@
234
                    continue;
235
                }
236
237
                if ($matchingParts > $selectedMatchingParts) {
238
                    // A more specific type wins.
239
                    $selectedContentType = $inexactContentType;
240
                    $selectedMatchingParts = $matchingParts;
241
                    $selectedQualityValue = $acceptType->getQualityValue();
242
                    $acceptable = $selectedQualityValue != 0;
243
                } else if ($matchingParts == $selectedMatchingParts) {
244
                    // A type with a higher q-value wins.
245
                    $candidateQualityValue = $acceptType->getQualityValue();
246
                    if ($candidateQualityValue > $selectedQualityValue) {
247
                        $selectedContentType = $inexactContentType;
248
                        $selectedQualityValue = $candidateQualityValue;
249
                        $acceptable = $selectedQualityValue != 0;
250
                    }
251
                }
252
            }
253
        }
254
@@ 305-320 (lines=16) @@
302
                        $selectedQualityValue = $acceptType->getQualityValue();
303
                        $selectedPreferenceIndex = $i;
304
                        $acceptable = $selectedQualityValue != 0;
305
                    } else if ($matchRating == $selectedMatchingParts) {
306
                        // A type with a higher q-value wins.
307
                        $candidateQualityValue = $acceptType->getQualityValue();
308
                        if ($candidateQualityValue > $selectedQualityValue) {
309
                            $selectedContentType = $availableType;
310
                            $selectedQualityValue = $candidateQualityValue;
311
                            $selectedPreferenceIndex = $i;
312
                            $acceptable = $selectedQualityValue != 0;
313
                        } else if ($candidateQualityValue == $selectedQualityValue) {
314
                            // A type that is earlier in the availableTypes array wins.
315
                            if ($i < $selectedPreferenceIndex) {
316
                                $selectedContentType = $availableType;
317
                                $selectedPreferenceIndex = $i;
318
                            }
319
                        }
320
                    }
321
                }
322
            }
323
        }