Code Duplication    Length = 15-15 lines in 2 locations

src/Util/StringUtil.php 2 locations

@@ 78-92 (lines=15) @@
75
        ));
76
    }
77
78
    public static function parseInteger($value, $nullable = true)
79
    {
80
        if ($nullable && (null === $value || 'null' === $value)) {
81
            return null;
82
        }
83
84
        if (is_numeric($value) || is_bool($value)) {
85
            return (int) $value;
86
        }
87
88
        throw new InvalidValueException(sprintf(
89
            'The value "%s" cannot be parsed as integer.',
90
            $value
91
        ));
92
    }
93
94
    public static function parseFloat($value, $nullable = true)
95
    {
@@ 94-108 (lines=15) @@
91
        ));
92
    }
93
94
    public static function parseFloat($value, $nullable = true)
95
    {
96
        if ($nullable && (null === $value || 'null' === $value)) {
97
            return null;
98
        }
99
100
        if (is_numeric($value) || is_bool($value)) {
101
            return (float) $value;
102
        }
103
104
        throw new InvalidValueException(sprintf(
105
            'The value "%s" cannot be parsed as float.',
106
            $value
107
        ));
108
    }
109
110
    public static function getLength($string, Formatter $formatter = null)
111
    {