Code Duplication    Length = 11-12 lines in 2 locations

src/Api/AbstractAdapter.php 2 locations

@@ 115-126 (lines=12) @@
112
    /**
113
     * {@inheritDoc}
114
     */
115
    public function createRecord($typeKey, Rest\RestPayload $payload) //, array $fields = [], array $inclusions = [])
116
    {
117
        // @todo Do normalized payloads need to be wrapped in an object, similar to persistence Records?
118
        $normalized = $this->normalize($payload);
119
        $this->validateCreatePayload($typeKey, $normalized);
120
121
        $model = $this->getStore()->create($normalized['type']);
122
        $model->apply($normalized['properties']);
123
        $model->save();
124
        $payload = $this->serialize($model);
125
        return $this->createRestResponse(201, $payload);
126
    }
127
128
    /**
129
     * {@inheritDoc}
@@ 131-141 (lines=11) @@
128
    /**
129
     * {@inheritDoc}
130
     */
131
    public function updateRecord($typeKey, $identifier, Rest\RestPayload $payload) // , array $fields = [], array $inclusions = [])
132
    {
133
        $normalized = $this->normalize($payload);
134
        $this->validateUpdatePayload($typeKey, $identifier, $normalized);
135
136
        $model = $this->getStore()->find($typeKey, $normalized['id']);
137
        $model->apply($normalized['properties']);
138
        $model->save();
139
        $payload = $this->serialize($model);
140
        return $this->createRestResponse(200, $payload);
141
    }
142
143
    /**
144
     * {@inheritDoc}