protected function castAsPhpType($value)
{
// We only check string values for type - object and array not - and double and int can keep as they are.
if (is_string($value) === true && is_numeric($value) === true) {
// Try to map a string or some similar type of a real type in PHP
// Try INT
if ((int) $value . "" === $value) {
$value = (int) $value;
// Try DOUBLE
} elseif ((double) $value . "" === $value) {
$value = (double) $value;
// Try BOOL
} elseif ((bool) $value . "" === $value) {
$value = (bool) $value;
}
}
return $value;
}