Code Duplication    Length = 11-11 lines in 4 locations

src/Charcoal/Object/ObjectSchedule.php 1 location

@@ 169-179 (lines=11) @@
166
     * @param array|string $data The data diff.
167
     * @return ObjectRevision
168
     */
169
    public function setDataDiff($data)
170
    {
171
        if (!is_array($data)) {
172
            $data = json_decode($data, true);
173
        }
174
        if ($data === null) {
175
            $data = [];
176
        }
177
        $this->dataDiff = $data;
178
        return $this;
179
    }
180
181
    /**
182
     * @return array

src/Charcoal/Object/ObjectRevision.php 3 locations

@@ 223-233 (lines=11) @@
220
     * @param  string|array|null $data The previous revision data.
221
     * @return ObjectRevision Chainable
222
     */
223
    public function setDataPrev($data)
224
    {
225
        if (!is_array($data)) {
226
            $data = json_decode($data, true);
227
        }
228
        if ($data === null) {
229
            $data = [];
230
        }
231
        $this->dataPrev = $data;
232
        return $this;
233
    }
234
235
    /**
236
     * @return array
@@ 247-257 (lines=11) @@
244
     * @param  array|string|null $data The current revision (object) data.
245
     * @return ObjectRevision Chainable
246
     */
247
    public function setDataObj($data)
248
    {
249
        if (!is_array($data)) {
250
            $data = json_decode($data, true);
251
        }
252
        if ($data === null) {
253
            $data = [];
254
        }
255
        $this->dataObj = $data;
256
        return $this;
257
    }
258
259
    /**
260
     * @return array
@@ 271-281 (lines=11) @@
268
     * @param  array|string $data The data diff.
269
     * @return ObjectRevision
270
     */
271
    public function setDataDiff($data)
272
    {
273
        if (!is_array($data)) {
274
            $data = json_decode($data, true);
275
        }
276
        if ($data === null) {
277
            $data = [];
278
        }
279
        $this->dataDiff = $data;
280
        return $this;
281
    }
282
283
    /**
284
     * @return array