/**
* 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;
}