Code Duplication    Length = 11-11 lines in 2 locations

src/Internal/CoOption.php 2 locations

@@ 164-174 (lines=11) @@
161
     * @throws InvalidArgumentException
162
     * @return float
163
     */
164
    private static function validateNaturalFloat($key, $value)
165
    {
166
        $value = filter_var($value, FILTER_VALIDATE_FLOAT);
167
        if ($value === false) {
168
            throw new \InvalidArgumentException("Option[$key] must be float.");
169
        }
170
        if ($value < 0.0) {
171
            throw new \DomainException("Option[$key] must be positive or zero.");
172
        }
173
        return $value;
174
    }
175
176
    /**
177
     * Validate natural int value.
@@ 183-193 (lines=11) @@
180
     * @throws InvalidArgumentException
181
     * @return int
182
     */
183
    private static function validateNaturalInt($key, $value)
184
    {
185
        $value = filter_var($value, FILTER_VALIDATE_INT);
186
        if ($value === false) {
187
            throw new \InvalidArgumentException("Option[$key] must be integer.");
188
        }
189
        if ($value < 0) {
190
            throw new \DomainException("Option[$key] must be positive or zero.");
191
        }
192
        return $value;
193
    }
194
}
195