Code Duplication    Length = 10-11 lines in 2 locations

src/POData/Writers/Json/JsonLightODataWriter.php 1 location

@@ 59-69 (lines=11) @@
56
     *
57
     * @return bool true if the writer can handle the response, false otherwise
58
     */
59
    public function canHandle(Version $responseVersion, $contentType)
60
    {
61
        if ($responseVersion != Version::v3()) {
62
            return false;
63
        }
64
65
        $parts = explode(';', $contentType);
66
67
        //It must be app/json and have the right odata= piece
68
        return in_array(MimeTypes::MIME_APPLICATION_JSON, $parts) && in_array($this->metadataLevel->getValue(), $parts);
69
    }
70
71
    /**
72
     * Write the given OData model in a specific response format.

src/POData/Writers/Json/JsonODataV1Writer.php 1 location

@@ 48-57 (lines=10) @@
45
     *
46
     * @return bool true if the writer can handle the response, false otherwise
47
     */
48
    public function canHandle(Version $responseVersion, $contentType)
49
    {
50
        if ($responseVersion != Version::v1()) {
51
            return false;
52
        }
53
54
        $parts = explode(';', $contentType);
55
56
        return in_array(MimeTypes::MIME_APPLICATION_JSON, $parts);
57
    }
58
59
    /**
60
     * Write the given OData model in a specific response format.