class ClassShortener in Devel 8.2
Same name and namespace in other branches
- 8.3 webprofiler/src/Helper/ClassShortener.php \Drupal\webprofiler\Helper\ClassShortener
- 8 webprofiler/src/Helper/ClassShortener.php \Drupal\webprofiler\Helper\ClassShortener
- 4.x webprofiler/src/Helper/ClassShortener.php \Drupal\webprofiler\Helper\ClassShortener
Class ClassShortener
Hierarchy
- class \Drupal\webprofiler\Helper\ClassShortener implements ClassShortenerInterface
Expanded class hierarchy of ClassShortener
1 string reference to 'ClassShortener'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses ClassShortener
File
- webprofiler/
src/ Helper/ ClassShortener.php, line 10
Namespace
Drupal\webprofiler\HelperView source
class ClassShortener implements ClassShortenerInterface {
/**
* {@inheritdoc}
*/
public function shortenClass($class) {
$parts = explode('\\', $class);
$result = [];
$size = count($parts) - 1;
foreach ($parts as $key => $part) {
if ($key < $size) {
$result[] = substr($part, 0, 1);
}
else {
$result[] = $part;
}
}
return new FormattableMarkup("<abbr title=\"@class\">@short</abbr>", [
'@class' => $class,
'@short' => implode('\\', $result),
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ClassShortener:: |
public | function |
Overrides ClassShortenerInterface:: |