Code Duplication    Length = 9-9 lines in 2 locations

src/Adapter.php 2 locations

@@ 48-56 (lines=9) @@
45
        switch ($request->getMethod()) {
46
            case 'GET':
47
                return $this->handleGetRequest($request);
48
            case 'POST':
49
                // @todo Must validate JSON content type
50
                if (false === $request->hasIdentifier()) {
51
                    if (true === $request->hasPayload()) {
52
                        return $this->createRecord($request->getEntityType(), $request->getPayload(), $request->getFieldset(), $request->getInclusions());
53
                    }
54
                    throw AdapterException::requestPayloadNotFound('Unable to create new entity.');
55
                }
56
                throw AdapterException::badRequest('Creating a new record while providing an id is not supported.');
57
            case 'PATCH':
58
                // @todo Must validate JSON content type
59
                if (false === $request->hasIdentifier()) {
@@ 57-65 (lines=9) @@
54
                    throw AdapterException::requestPayloadNotFound('Unable to create new entity.');
55
                }
56
                throw AdapterException::badRequest('Creating a new record while providing an id is not supported.');
57
            case 'PATCH':
58
                // @todo Must validate JSON content type
59
                if (false === $request->hasIdentifier()) {
60
                    throw AdapterException::badRequest('No identifier found. You must specify an ID in the URL.');
61
                }
62
                if (false === $request->hasPayload()) {
63
                    throw AdapterException::requestPayloadNotFound('Unable to update entity.');
64
                }
65
                return $this->updateRecord($request->getEntityType(), $request->getIdentifier(), $request->getPayload(), $request->getFieldset(), $request->getInclusions());
66
            case 'DELETE':
67
                if (false === $request->hasIdentifier()) {
68
                    throw AdapterException::badRequest('No identifier found. You must specify an ID in the URL.');