{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% block head %} {{ parent() }} {% endblock %} {% block toolbar %} {% if collector.handledCount > 0 %} {% set icon %} {{ source('@WebProfiler/Icon/serializer.svg') }} {{ collector.handledCount }} {% endset %} {% set text %}
Total calls {{ collector.handledCount }}
Total time {{ '%.2f'|format(collector.totalTime * 1000) }} ms
Serialize {{ collector.data.serialize|length }}
Deserialize {{ collector.data.deserialize|length }}
Encode {{ collector.data.encode|length }}
Decode {{ collector.data.decode|length }}
Normalize {{ collector.data.normalize|length }}
Denormalize {{ collector.data.denormalize|length }}
{% endset %} {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }} {% endif %} {% endblock %} {% block menu %} {{ source('@WebProfiler/Icon/serializer.svg') }} Serializer {% endblock %} {% block panel %}

Serializer

{% if not collector.handledCount %}

Nothing was handled by the serializer for this request.

{% else %}
{{ collector.handledCount }} Handled
{{ '%.2f'|format(collector.totalTime * 1000) }} ms Total time
{{ _self.render_serialize_tab(collector.data, true) }} {{ _self.render_serialize_tab(collector.data, false) }} {{ _self.render_normalize_tab(collector.data, true) }} {{ _self.render_normalize_tab(collector.data, false) }} {{ _self.render_encode_tab(collector.data, true) }} {{ _self.render_encode_tab(collector.data, false) }}
{% endif %}
{% endblock %} {% macro render_serialize_tab(collectorData, serialize) %} {% set data = serialize ? collectorData.serialize : collectorData.deserialize %} {% set cellPrefix = serialize ? 'serialize' : 'deserialize' %}

{{ serialize ? 'serialize' : 'deserialize' }} {{ data|length }}

{% if not data|length %}

Nothing was {{ serialize ? 'serialized' : 'deserialized' }}.

{% else %} {% for item in data %} {% endfor %}
Data Context Normalizer Encoder Time Caller
{{ _self.render_data_cell(item, loop.index, cellPrefix) }} {{ _self.render_context_cell(item, loop.index, cellPrefix) }} {{ _self.render_normalizer_cell(item, loop.index, cellPrefix) }} {{ _self.render_encoder_cell(item, loop.index, cellPrefix) }} {{ _self.render_time_cell(item) }} {{ _self.render_caller_cell(item, loop.index, cellPrefix) }}
{% endif %}
{% endmacro %} {% macro render_caller_cell(item, index, method) %} {% if item.caller is defined %} {% set caller = item.caller %} {% if caller.line %} {% set link = caller.file|file_link(caller.line) %} {% if link %} {{ caller.name }} {% else %} {{ caller.name }} {% endif %} {% else %} {{ caller.name }} {% endif %} line {{ caller.line }} {% endif %} {% endmacro %} {% macro render_normalize_tab(collectorData, normalize) %} {% set data = normalize ? collectorData.normalize : collectorData.denormalize %} {% set cellPrefix = normalize ? 'normalize' : 'denormalize' %}

{{ normalize ? 'normalize' : 'denormalize' }} {{ data|length }}

{% if not data|length %}

Nothing was {{ normalize ? 'normalized' : 'denormalized' }}.

{% else %} {% for item in data %} {% endfor %}
Data Context Normalizer Time Caller
{{ _self.render_data_cell(item, loop.index, cellPrefix) }} {{ _self.render_context_cell(item, loop.index, cellPrefix) }} {{ _self.render_normalizer_cell(item, loop.index, cellPrefix) }} {{ _self.render_time_cell(item) }} {{ _self.render_caller_cell(item, loop.index, cellPrefix) }}
{% endif %}
{% endmacro %} {% macro render_encode_tab(collectorData, encode) %} {% set data = encode ? collectorData.encode : collectorData.decode %} {% set cellPrefix = encode ? 'encode' : 'decode' %}

{{ encode ? 'encode' : 'decode' }} {{ data|length }}

{% if not data|length %}

Nothing was {{ encode ? 'encoded' : 'decoded' }}.

{% else %} {% for item in data %} {% endfor %}
Data Context Encoder Time Caller
{{ _self.render_data_cell(item, loop.index, cellPrefix) }} {{ _self.render_context_cell(item, loop.index, cellPrefix) }} {{ _self.render_encoder_cell(item, loop.index, cellPrefix) }} {{ _self.render_time_cell(item) }} {{ _self.render_caller_cell(item, loop.index, cellPrefix) }}
{% endif %}
{% endmacro %} {% macro render_data_cell(item, index, method) %} {% set data_id = 'data-' ~ method ~ '-' ~ index %} {{ item.dataType }}
Show contents
{{ profiler_dump(item.data) }}
{% endmacro %} {% macro render_context_cell(item, index, method) %} {% set context_id = 'context-' ~ method ~ '-' ~ index %} {% if item.type %} Type: {{ item.type }}
Format: {{ item.format ? item.format : 'none' }}
{% else %} Format: {{ item.format ? item.format : 'none' }} {% endif %}
Show context
{{ profiler_dump(item.context) }}
{% endmacro %} {% macro render_normalizer_cell(item, index, method) %} {% set nested_normalizers_id = 'nested-normalizers-' ~ method ~ '-' ~ index %} {% if item.normalizer is defined %} {{ item.normalizer.class }} ({{ '%.2f'|format(item.normalizer.time * 1000) }} ms) {% endif %} {% if item.normalization|length > 1 %}
Show nested normalizers
{% endif %} {% endmacro %} {% macro render_encoder_cell(item, index, method) %} {% set nested_encoders_id = 'nested-encoders-' ~ method ~ '-' ~ index %} {% if item.encoder is defined %} {{ item.encoder.class }} ({{ '%.2f'|format(item.encoder.time * 1000) }} ms) {% endif %} {% if item.encoding|length > 1 %}
Show nested encoders
{% endif %} {% endmacro %} {% macro render_time_cell(item) %} {{ '%.2f'|format(item.time * 1000) }} ms {% endmacro %}