function kintParser::_parse_string
File
-
kint/
kint/ inc/ kintParser.class.php, line 560
Class
Code
private static function _parse_string(&$variable, kintVariableData $variableData) {
$variableData->type = 'string';
$encoding = self::_detectEncoding($variable);
if ($encoding !== 'ASCII') {
$variableData->type .= ' ' . $encoding;
}
$variableData->size = self::_strlen($variable, $encoding);
if (Kint::enabled() !== Kint::MODE_RICH) {
$variableData->value = '"' . self::escape($variable, $encoding) . '"';
return;
}
if (!self::$_placeFullStringInValue) {
$strippedString = preg_replace('[\\s+]', ' ', $variable);
if (Kint::$maxStrLength && $variableData->size > Kint::$maxStrLength) {
// encode and truncate
$variableData->value = '"' . self::escape(self::_substr($strippedString, 0, Kint::$maxStrLength, $encoding), $encoding) . '…"';
$variableData->extendedValue = self::escape($variable, $encoding);
return;
}
elseif ($variable !== $strippedString) {
// omit no data from display
$variableData->value = '"' . self::escape($variable, $encoding) . '"';
$variableData->extendedValue = self::escape($variable, $encoding);
return;
}
}
$variableData->value = '"' . self::escape($variable, $encoding) . '"';
}