Code Duplication    Length = 4-4 lines in 2 locations

src/Negotiation/AcceptNegotiator.php 1 location

@@ 41-44 (lines=4) @@
38
            $headerValueParts = explode(';', $headerValue);
39
            $mimeType = trim(array_shift($headerValueParts));
40
            $attributes = [];
41
            foreach ($headerValueParts as $attribute) {
42
                list($attributeKey, $attributeValue) = explode('=', $attribute);
43
                $attributes[trim($attributeKey)] = trim($attributeValue);
44
            }
45
46
            if (!isset($attributes['q'])) {
47
                $attributes['q'] = '1.0';

src/Negotiation/ContentTypeNegotiator.php 1 location

@@ 42-45 (lines=4) @@
39
        $headerValueParts = explode(';', $header);
40
        $mimeType = trim(array_shift($headerValueParts));
41
        $attributes = [];
42
        foreach ($headerValueParts as $attribute) {
43
            list($attributeKey, $attributeValue) = explode('=', $attribute);
44
            $attributes[trim($attributeKey)] = trim($attributeValue);
45
        }
46
47
        if (in_array($mimeType, $supportedMimeTypes, true)) {
48
            return new NegotiatedValue($mimeType, $attributes);