Skip to content

Commit

Permalink
fix: Fix web profiler HTML.
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Feb 6, 2024
1 parent 4023f15 commit a6e4b2c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Full documentation is available at [rekalogika.dev/mapper](https://rekalogika.de

* Option to read & write to private properties.
* Data collector and profiler integration.
* Lazy-loading proxy for target objects.
* Cache eviction if involved classes change in debug mode.

## Installation

Expand Down
8 changes: 4 additions & 4 deletions src/Util/TypeUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public static function getTypeStringHtml(Type|MixedType $type): string
} else {
$shortClassName = preg_replace('/^.*\\\\/', '', $typeString) ?? $typeString;
$typeString = sprintf(
'<abbr title="%s">%s</a>',
'<abbr title="%s">%s</abbr>',
\htmlspecialchars($typeString),
\htmlspecialchars($shortClassName)
);
Expand All @@ -337,7 +337,7 @@ public static function getTypeStringHtml(Type|MixedType $type): string
if ($keyTypes) {
$keyTypesString = [];
foreach ($keyTypes as $keyType) {
$keyTypesString[] = self::getTypeString($keyType);
$keyTypesString[] = self::getTypeStringHtml($keyType);
}
$keyTypesString = implode('|', $keyTypesString);
} else {
Expand All @@ -349,14 +349,14 @@ public static function getTypeStringHtml(Type|MixedType $type): string
if ($valueTypes) {
$valueTypesString = [];
foreach ($valueTypes as $valueType) {
$valueTypesString[] = self::getTypeString($valueType);
$valueTypesString[] = self::getTypeStringHtml($valueType);
}
$valueTypesString = implode('|', $valueTypesString);
} else {
$valueTypesString = 'mixed';
}

$typeString .= sprintf('<%s,%s>', $keyTypesString, $valueTypesString);
$typeString .= sprintf('&lt;%s,%s&gt;', $keyTypesString, $valueTypesString);
}

return $typeString;
Expand Down
24 changes: 16 additions & 8 deletions templates/data_collector.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,27 @@

{% macro render_row(tracedata, depth) %}
<tr>
<td>
{% if depth > 0 %}
{% for i in 1..depth %}&nbsp;&nbsp;{% endfor %}{{ tracedata.path ?? '(root)' }}
{% else %}
{{ tracedata.path ?? '(root)' }}
{% endif %}
</td>
{% spaceless %}
<td>
{% if depth %}
{% for i in 1..depth %}&nbsp;
{% endfor %}
&nbsp;
{{ tracedata.path ?? '(???)' }}
{% else %}
{{ tracedata.path ?? '(root)' }}
{% endif %}
</td>
{% endspaceless %}
<td>{{ tracedata.sourceType|abbr_class }}</td>
<td>{{ tracedata.existingTargetType|abbr_class }}</td>
<td>{{ tracedata.targetType|raw }}</td>
<td>{{ tracedata.resultType|abbr_class }}</td>
<td>{{ tracedata.transformerClass|abbr_class }}</td>
<td><span class="nowrap">{{ '%.2f'|format(tracedata.time * 1000) }} ms</span></td>
<td>
<span class="nowrap">{{ '%.2f'|format(tracedata.time * 1000) }}
ms</span>
</td>
</tr>

{% for child in tracedata.nestedTraceData %}
Expand Down

0 comments on commit a6e4b2c

Please sign in to comment.