public static function parseInteger($value, $nullable = true)
{
if ($nullable && (null === $value || 'null' === $value)) {
return null;
}
if (is_numeric($value) || is_bool($value)) {
return (int) $value;
}
throw new InvalidValueException(sprintf('The value "%s" cannot be parsed as integer.', $value));
}