Code Duplication    Length = 13-13 lines in 2 locations

src/delivery/cli/fields/PrimitiveField.php 1 location

@@ 33-45 (lines=13) @@
30
     * @param string $serialized
31
     * @return mixed
32
     */
33
    public function inflate(Parameter $parameter, $serialized) {
34
        switch (get_class($parameter->getType())) {
35
            case LongType::class:
36
            case IntegerType::class:
37
                return (int)$serialized;
38
            case DoubleType::class:
39
                return (double)$serialized;
40
            case FloatType::class:
41
                return (float)$serialized;
42
            default:
43
                return (string)$serialized;
44
        }
45
    }
46
47
    /**
48
     * @param Parameter $parameter

src/delivery/web/fields/NumberField.php 1 location

@@ 32-44 (lines=13) @@
29
     * @param string $serialized
30
     * @return int|float|double
31
     */
32
    public function inflate(Parameter $parameter, $serialized) {
33
        switch (get_class($parameter->getType())) {
34
            case LongType::class:
35
            case IntegerType::class:
36
                return (int)$serialized;
37
            case DoubleType::class:
38
                return (double)$serialized;
39
            case FloatType::class:
40
                return (float)$serialized;
41
            default:
42
                throw new \InvalidArgumentException("Not a number type [{$parameter->getType()}]");
43
        }
44
    }
45
46
    /**
47
     * @param Parameter $parameter