Code Duplication    Length = 15-16 lines in 2 locations

src/POData/HttpProcessUtility.php 2 locations

@@ 61-75 (lines=15) @@
58
                    continue;
59
                }
60
61
                if ($matchingParts > $selectedMatchingParts) {
62
                    // A more specific type wins.
63
                    $selectedContentType = $inexactContentType;
64
                    $selectedMatchingParts = $matchingParts;
65
                    $selectedQualityValue = $acceptType->getQualityValue();
66
                    $acceptable = $selectedQualityValue != 0;
67
                } elseif ($matchingParts == $selectedMatchingParts) {
68
                    // A type with a higher q-value wins.
69
                    $candidateQualityValue = $acceptType->getQualityValue();
70
                    if ($candidateQualityValue > $selectedQualityValue) {
71
                        $selectedContentType = $inexactContentType;
72
                        $selectedQualityValue = $candidateQualityValue;
73
                        $acceptable = $selectedQualityValue != 0;
74
                    }
75
                }
76
            }
77
        }
78
@@ 130-145 (lines=16) @@
127
                        $selectedQualityValue = $acceptType->getQualityValue();
128
                        $selectedPreferenceIndex = $i;
129
                        $acceptable = $selectedQualityValue != 0;
130
                    } elseif ($matchRating == $selectedMatchingParts) {
131
                        // A type with a higher q-value wins.
132
                        $candidateQualityValue = $acceptType->getQualityValue();
133
                        if ($candidateQualityValue > $selectedQualityValue) {
134
                            $selectedContentType = $availableType;
135
                            $selectedQualityValue = $candidateQualityValue;
136
                            $selectedPreferenceIndex = $i;
137
                            $acceptable = $selectedQualityValue != 0;
138
                        } elseif ($candidateQualityValue == $selectedQualityValue) {
139
                            // A type that is earlier in the availableTypes array wins.
140
                            if ($i < $selectedPreferenceIndex) {
141
                                $selectedContentType = $availableType;
142
                                $selectedPreferenceIndex = $i;
143
                            }
144
                        }
145
                    }
146
                }
147
            }
148
        }