{% extends 'base.html.twig' %}

{% block content %}
    {% include('components/breadcrumbs.html.twig') %}

    <article class="phpdocumentor-element -file">
        {{ include('components/file-title.html.twig') }}
        {{ include('components/summary.html.twig') }}
        {{ include('components/deprecation.html.twig') }}
        {{ include('components/description.html.twig') }}
        {{ include('components/tags.html.twig', {node: node}) }}

        {{ include ('components/table-of-contents.html.twig') }}

        {{ include('components/constants.html.twig') }}
        {{ include('components/functions.html.twig') }}
        {{ include('components/source-modal.html.twig') }}
    </article>
{% endblock %}

{% block on_this_page %}
    {% set constants = constants(node) %}
    {% set functions = node.functions|default([]) %}

    <section class="phpdocumentor-on-this-page__content">
        <strong class="phpdocumentor-on-this-page__title">On this page</strong>

        <ul class="phpdocumentor-list -clean">
            <li class="phpdocumentor-on-this-page-section__title">Table Of Contents</li>
            <li>
                <ul class="phpdocumentor-list -clean">
                    {% if node.packages is not empty %}
                        <li><a href="{{ link(node) }}#packages">Packages</a></li>
                    {% endif %}
                    {% if node.namespaces is not empty %}
                        <li><a href="{{ link(node) }}#namespaces">Namespaces</a></li>
                    {% endif %}
                    {% if node.interfaces is not empty %}
                        <li><a href="{{ link(node) }}#toc-interfaces">Interfaces</a></li>
                    {% endif %}
                    {% if node.classes is not empty %}
                        <li><a href="{{ link(node) }}#toc-classes">Classes</a></li>
                    {% endif %}
                    {% if node.traits is not empty %}
                        <li><a href="{{ link(node) }}#toc-traits">Traits</a></li>
                    {% endif %}
                    {% if node.enums is not empty %}
                        <li><a href="{{ link(node) }}#toc-enums">Enums</a></li>
                    {% endif %}
                    {% if node.constants is not empty %}
                        <li><a href="{{ link(node) }}#toc-constants">Constants</a></li>
                    {% endif %}
                    {% if node.functions is not empty %}
                        <li><a href="{{ link(node) }}#toc-functions">Functions</a></li>
                    {% endif %}
                </ul>
            </li>

            {% if constants is not empty %}
                <li class="phpdocumentor-on-this-page-section__title">Constants</li>
                <li>
                    <ul class="phpdocumentor-list -clean">
                        {% for constant in constants|sortByVisibility %}
                            <li class="{% if constants.deprecated %}-deprecated{% endif %}"><a href="{{ link(constant) }}">{{ constant.name }}</a></li>
                        {% endfor %}
                    </ul>
                </li>
            {% endif %}

            {% if functions is not empty %}
                <li class="phpdocumentor-on-this-page-section__title">Functions</li>
                <li>
                    <ul class="phpdocumentor-list -clean">
                        {% for function in functions|sortByVisibility %}
                            <li class="{% if function.deprecated %}-deprecated{% endif %}"><a href="{{ link(function) }}">{{ function.name }}()</a></li>
                        {% endfor %}
                    </ul>
                </li>
            {% endif %}
        </ul>
    </section>
{% endblock %}
