X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fdevel%2Fwebprofiler%2Fsrc%2FTwig%2FDumper%2FHtmlDumper.php;fp=web%2Fmodules%2Fcontrib%2Fdevel%2Fwebprofiler%2Fsrc%2FTwig%2FDumper%2FHtmlDumper.php;h=7b3ac02b0ef9d95d8015b2a4c9a3b1b25facb5ea;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/devel/webprofiler/src/Twig/Dumper/HtmlDumper.php b/web/modules/contrib/devel/webprofiler/src/Twig/Dumper/HtmlDumper.php new file mode 100644 index 000000000..7b3ac02b0 --- /dev/null +++ b/web/modules/contrib/devel/webprofiler/src/Twig/Dumper/HtmlDumper.php @@ -0,0 +1,35 @@ + '#dfd', + 'macro' => '#ddf', + 'template' => '#ffd', + 'big' => '#d44', + ); + + /** + * {@inheritdoc} + */ + public function dump(\Twig_Profiler_Profile $profile) { + return '
' . parent::dump($profile) . '
'; + } + + protected function formatTemplate(\Twig_Profiler_Profile $profile, $prefix) { + return sprintf('%s└ %s', $prefix, self::$colors['template'], $profile->getTemplate()); + } + + protected function formatNonTemplate(\Twig_Profiler_Profile $profile, $prefix) { + return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); + } + + protected function formatTime(\Twig_Profiler_Profile $profile, $percent) { + return sprintf('%.2fms/%.0f%%', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); + } +}