Code Duplication    Length = 9-9 lines in 8 locations

src/Core/Model/CustomField/FieldContainer.php 8 locations

@@ 267-275 (lines=9) @@
264
    /**
265
     * @return Set
266
     */
267
    public function getFieldAsLocalizedStringSet($name)
268
    {
269
        $value = $this->get($name);
270
271
        if ($value instanceof Set && $value->getType() == LocalizedString::class) {
272
            return $value;
273
        }
274
        return Set::ofTypeAndData(LocalizedString::class, $value);
275
    }
276
277
    /**
278
     * @return Set
@@ 280-288 (lines=9) @@
277
    /**
278
     * @return Set
279
     */
280
    public function getFieldAsLocalizedEnumSet($name)
281
    {
282
        $value = $this->get($name);
283
284
        if ($value instanceof Set && $value->getType() == LocalizedEnum::class) {
285
            return $value;
286
        }
287
        return Set::ofTypeAndData(LocalizedEnum::class, $value);
288
    }
289
290
    /**
291
     * @return Set
@@ 293-301 (lines=9) @@
290
    /**
291
     * @return Set
292
     */
293
    public function getFieldAsEnumSet($name)
294
    {
295
        $value = $this->get($name);
296
297
        if ($value instanceof Set && $value->getType() == Enum::class) {
298
            return $value;
299
        }
300
        return Set::ofTypeAndData(Enum::class, $value);
301
    }
302
303
    /**
304
     * @return Set
@@ 306-314 (lines=9) @@
303
    /**
304
     * @return Set
305
     */
306
    public function getFieldAsMoneySet($name)
307
    {
308
        $value = $this->get($name);
309
310
        if ($value instanceof Set && $value->getType() == Money::class) {
311
            return $value;
312
        }
313
        return Set::ofTypeAndData(Money::class, $value);
314
    }
315
316
    /**
317
     * @return Set
@@ 319-327 (lines=9) @@
316
    /**
317
     * @return Set
318
     */
319
    public function getFieldAsDateSet($name)
320
    {
321
        $value = $this->get($name);
322
323
        if ($value instanceof Set && $value->getType() == DateDecorator::class) {
324
            return $value;
325
        }
326
        return Set::ofTypeAndData(DateDecorator::class, $value);
327
    }
328
329
    /**
330
     * @return Set
@@ 332-340 (lines=9) @@
329
    /**
330
     * @return Set
331
     */
332
    public function getFieldAsTimeSet($name)
333
    {
334
        $value = $this->get($name);
335
336
        if ($value instanceof Set && $value->getType() == TimeDecorator::class) {
337
            return $value;
338
        }
339
        return Set::ofTypeAndData(TimeDecorator::class, $value);
340
    }
341
342
    /**
343
     * @return Set
@@ 345-353 (lines=9) @@
342
    /**
343
     * @return Set
344
     */
345
    public function getFieldAsDateTimeSet($name)
346
    {
347
        $value = $this->get($name);
348
349
        if ($value instanceof Set && $value->getType() == DateTimeDecorator::class) {
350
            return $value;
351
        }
352
        return Set::ofTypeAndData(DateTimeDecorator::class, $value);
353
    }
354
355
    /**
356
     * @return Set
@@ 358-366 (lines=9) @@
355
    /**
356
     * @return Set
357
     */
358
    public function getFieldAsReferenceSet($name)
359
    {
360
        $value = $this->get($name);
361
362
        if ($value instanceof Set && $value->getType() == Reference::class) {
363
            return $value;
364
        }
365
        return Set::ofTypeAndData(Reference::class, $value);
366
    }
367
}
368