private function TranslationDataCollector::sanitizeString in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/translation/DataCollector/TranslationDataCollector.php \Symfony\Component\Translation\DataCollector\TranslationDataCollector::sanitizeString()
1 call to TranslationDataCollector::sanitizeString()
- TranslationDataCollector::sanitizeCollectedMessages in vendor/
symfony/ translation/ DataCollector/ TranslationDataCollector.php
File
- vendor/
symfony/ translation/ DataCollector/ TranslationDataCollector.php, line 131
Class
- TranslationDataCollector
- @author Abdellatif Ait boudad <a.aitboudad@gmail.com>
Namespace
Symfony\Component\Translation\DataCollectorCode
private function sanitizeString($string, $length = 80) {
$string = trim(preg_replace('/\\s+/', ' ', $string));
if (function_exists('mb_strlen') && false !== ($encoding = mb_detect_encoding($string))) {
if (mb_strlen($string, $encoding) > $length) {
return mb_substr($string, 0, $length - 3, $encoding) . '...';
}
}
elseif (strlen($string) > $length) {
return substr($string, 0, $length - 3) . '...';
}
return $string;
}