You are here

protected function HtmlDrupalDumper::getClassStyle in VarDumper 8

Parameters

$style:

$v:

$c:

Return value

string

1 call to HtmlDrupalDumper::getClassStyle()
HtmlDrupalDumper::style in src/VarDumper/Dumper/HtmlDrupalDumper.php

File

src/VarDumper/Dumper/HtmlDrupalDumper.php, line 141

Class

HtmlDrupalDumper
HtmlDrupalDumper dumps variables as HTML.

Namespace

Drupal\vardumper\VarDumper\Dumper

Code

protected function getClassStyle($style, $v, $c) {
  if (\Drupal::hasService('webprofiler.ide_link_generator') && \Drupal::hasService('webprofiler.class_shortener')) {
    $ideLinkGenerator = \Drupal::service('webprofiler.ide_link_generator');
    $classShortener = \Drupal::service('webprofiler.class_shortener');
    $reflectedClass = new \ReflectionClass($v);
    $file = $reflectedClass
      ->getFileName();
    $ideLink = $ideLinkGenerator
      ->generateLink($file, 0);
    $abbr = $classShortener
      ->shortenClass($v, 'sf-dump-' . $style);
    return sprintf('<a href=%s>%s</a>', $ideLink, $abbr);
  }
  return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>', $v, $style, mb_substr($v, $c + 1));
}