Skip to content

Commit 87c55ed

Browse files
ymorocuttiYoann MOROCUTTI
andauthored
Feature/twig (#57)
* feat: Fix an issue where this extension is not working anymore with twig/twig 3.21.0. An additional issue where response code N/A was not correctly handled in profiler [twig] * fix: Fix some CSS issue when significant request/response body was displayed in our profiler [twig] * build: Upgrade PHPStan to 2.0 [twig] --------- Co-authored-by: Yoann MOROCUTTI <Yoann.MOROCUTTI@boursorama.fr>
1 parent 6b8b144 commit 87c55ed

7 files changed

Lines changed: 162 additions & 159 deletions

File tree

Resources/views/Collector/partials/call.html.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@
105105
{% if call.curlCommand is defined %}
106106
<div class="tab-content-curl">
107107
<div class="active" style="display:block;">
108-
<table>
108+
<table style="table-layout: fixed">
109109
<tbody>
110110
<tr>
111-
<td>
112-
<pre style="white-space: pre-line; word-break: break-word;">{{ call.curlCommand | raw }}</pre>
111+
<td class="full-width" style="overflow-wrap: break-word">
112+
<pre style="white-space: pre-line">{{ call.curlCommand | raw }}</pre>
113113
</td>
114114
</tr>
115115
</tbody>
@@ -120,11 +120,11 @@
120120
{% if call.blackfireCommand is defined %}
121121
<div class="tab-content-blackfire">
122122
<div class="active" style="display:block;">
123-
<table>
123+
<table style="table-layout: fixed">
124124
<tbody>
125125
<tr>
126-
<td>
127-
<pre style="white-space: pre-line; word-break: break-word;">{{ call.blackfireCommand | raw }}</pre>
126+
<td class="full-width" style="overflow-wrap: break-word">
127+
<pre style="white-space: pre-line">{{ call.blackfireCommand | raw }}</pre>
128128
</td>
129129
</tr>
130130
</tbody>

Resources/views/Collector/partials/request.html.twig

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
{% macro display_array_recursive(array, separator = ', ', opening_char = '[', closing_char = ']') -%}
2-
{{ opening_char }}
3-
{%- for key, value in array -%}
4-
{%- if value is iterable -%}
5-
{{ key }} => {{ _self.display_array_recursive(value, separator, opening_char, closing_char) }}
6-
{%- else -%}
7-
{{ key }} => {{ value }}
8-
{%- if not loop.last %}{{ separator }}{% endif -%}
9-
{%- endif -%}
10-
{%- endfor -%}
11-
{{ closing_char }}
2+
{{ opening_char }}
3+
{%- for key, value in array -%}
4+
{%- if value is iterable -%}
5+
{{ key }} => {{ _self.display_array_recursive(value, separator, opening_char, closing_char) }}
6+
{%- else -%}
7+
{{ key }} => {{ value }}
8+
{%- if not loop.last %}{{ separator }}{% endif -%}
9+
{%- endif -%}
10+
{%- endfor -%}
11+
{{ closing_char }}
1212
{%- endmacro %}
1313

1414

1515

1616
{% if request.query %}
17-
<h5>Query Parameters</h5>
17+
<h5>Query Parameters</h5>
1818

19-
<table>
20-
<tbody>
19+
<table style="table-layout: fixed">
20+
<tbody>
2121
{% for name,parameter in request.query %}
22-
<tr>
23-
<th>{{ name }}</th>
24-
<td>
25-
{% if parameter is iterable %}
26-
{{ _self.display_array_recursive(parameter) }}
27-
{% else %}
28-
{{ parameter }}
29-
{% endif %}
30-
</td>
31-
</tr>
22+
<tr>
23+
<th>{{ name }}</th>
24+
<td>
25+
{% if parameter is iterable %}
26+
{{ _self.display_array_recursive(parameter) }}
27+
{% else %}
28+
{{ parameter }}
29+
{% endif %}
30+
</td>
31+
</tr>
3232
{% endfor %}
33-
</tbody>
34-
</table>
33+
</tbody>
34+
</table>
3535
{% endif %}
3636

3737

3838
{% if request.content %}
39-
<h5>Body</h5>
39+
<h5>Body</h5>
4040

41-
<table>
42-
<tbody>
41+
<table style="table-layout: fixed">
42+
<tbody>
4343
<tr>
44-
<td style="padding:0">
44+
<td class="full-width" style="overflow-wrap: break-word">
4545
{{ request.content | simple_http_beautify(request.contentType) }}
4646
</td>
4747
</tr>
48-
</tbody>
49-
</table>
48+
</tbody>
49+
</table>
5050
{% endif %}
5151

5252
<h5>Headers</h5>
53-
<table>
53+
<table style="table-layout: fixed">
5454
<tbody>
5555
{% for header in request.headers %}
5656
<tr>
57-
<td>{{ header|join('<strong>, </strong>') }}</td>
57+
<td class="full-width" style="overflow-wrap: break-word">{{ header|join('<strong>, </strong>') }}</td>
5858
</tr>
5959
{% endfor %}
6060
</tbody>

Resources/views/Collector/partials/response.html.twig

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22

33
<h5>Body</h5>
44

5-
<table>
5+
<table style="table-layout: fixed">
66
<tbody>
7-
<tr>
8-
<td>{{ response.body }}</td>
9-
</tr>
7+
<tr>
8+
<td class="full-width" style="overflow-wrap: break-word">
9+
<pre>{{ response.body }}</pre>
10+
</td>
11+
</tr>
1012
</tbody>
1113
</table>
1214

1315
<h5>Headers</h5>
1416

15-
<table>
17+
<table style="table-layout: fixed">
1618
<tbody>
1719
{% for header in response.headers %}
1820
<tr>
19-
<td>
21+
<td class="full-width" style="overflow-wrap: break-word">
2022
{{ header }}
2123
</td>
2224
</tr>

0 commit comments

Comments
 (0)