public static canBeTreatedAsInt ( string $value ) : boolean | ||
$value | string | string representation of a certain value |
return | boolean |
public static function canBeTreatedAsInt($value)
{
return (bool) (strval($value) === strval(intval($value)));
}
/** * Fills in a value of a binding and truncates the * resulting string if necessary. * * @param mixed $value bound value * * @return string */ protected function fillInValue($value) { if (is_null($value)) { $value = 'NULL'; } $value = strval($value); if (strlen($value) > $this->strLen) { $value = substr($value, 0, $this->strLen) . '... '; } if (!\RedBeanPHP\QueryWriter\AQueryWriter::canBeTreatedAsInt($value) && $value !== 'NULL') { $value = '\'' . $value . '\''; } return $value; }