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

{% block content %}
	<section class="row-fluid">
		<div class="span2 sidebar">
			{% set namespace = project.namespace %}
			{{ block('sidebarNamespaces') }}
		</div>
	</section>
	<section class="row-fluid">
		<div class="span10 offset2">
			<div class="row-fluid">
				<div class="span8 content class">
					<nav>
						{#<a href="" class="pull-left">&laquo; NamespaceAssembler</a>#}
						{{ node.namespace|route|raw }}
						{#<a href="" class="pull-right">ClassAssembler &raquo;</a>#}
					</nav>
					{% if project.settings.shouldIncludeSource %}
						<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal">
							<i class="fa-solid fa-code"></i>
						</a>
					{% endif %}

					<h1>
						<small>{{ node.namespace }}</small>
						{{ node.name }}</h1>
					<p>
						<em>{{ node.summary }}</em>
					</p>
					{{ node.description|markdown|raw }}

					<section id="summary">
						<h2>Summary</h2>
						<section class="row-fluid heading">
							<section class="span6">
								<a href="#methods">Methods</a>
							</section>
							<section class="span6">
								<a href="#constants">Constants</a>
							</section>
						</section>
						<section class="row-fluid public">
							<section class="span6">
								{% for method in node.inheritedMethods.merge(node.methods) %}
									{% if method.visibility == 'public' %}
										<a href="{{ method|route('url') }}">{{ method.name }}()</a><br/>
									{% else %}
										<em>No public methods found</em>
									{% endif %}
								{% endfor %}
							</section>
							<section class="span6">
								{% for constant in node.inheritedConstants.merge(node.constants) %}
									<a href="{{ constant|route('url') }}">{{ constant.name }}</a><br/>
								{% else %}
									<em>No public constants found</em>
								{% endfor %}
							</section>
						</section>
					</section>
				</div>
				<aside class="span4 detailsbar">
					{% if method.deprecated %}
						<aside class="alert alert-block alert-info">
							<h4>Deprecated</h4>
							{{ method.tags.deprecated[0].description }}
						</aside>
					{% endif %}
					<dl>
						<dt>File</dt>
						<dd>
							<a href="{{ node.file|route('url') }}">
								<div class="path-wrapper">{{ node.path }}</div>
							</a>
						</dd>
						{% if node.package is not empty and node.package != '\\' %}
							<dt>Package</dt>
							<dd>
								<div class="namespace-wrapper">{{ node.subpackage ? (node.package ~ '\\' ~ node.subpackage) : node.package }}</div>
							</dd>
						{% endif %}
						{% for parent in node.parent %}
							{% if loop.first %}
								<dt>Parents</dt>
							{% endif %}
							<dd>
								<a href="{{ parent|route('url') }}">
									<div class="namespace-wrapper">{{ parent.fullyQualifiedStructuralElementName }}</div>
								</a>
							</dd>
						{% endfor %}

						{% for tag_name, tags in node.tags %}
							{% if tag_name in ['link', 'see'] %}
								{% if loop.first %}
									<dt>See also</dt>
								{% endif %}
								{% for tag in tags %}
									<dd>
										<a href="{{ tag.reference|route('url') ?: tag.link }}">
											<div class="namespace-wrapper">{{ tag.description ?: tag.reference }}</div>
										</a>
									</dd>
								{% endfor %}
							{% endif %}
						{% endfor %}
					</dl>
					<h2>Tags</h2>
					<table class="table table-condensed">
						{% for tag_name, tags in node.tags %}
							{% if tag_name not in ['link', 'see', 'abstract', 'method', 'package', 'subpackage'] %}
								<tr>
									<th>{{ tag_name }}</th>
									<td>
										{% for tag in tags %}
											{% if tag.version %}
												{{ tag.version }}
											{% endif %}
											{{ tag.description|markdown|raw }}
										{% endfor %}
									</td>
								</tr>
							{% else %}
								<tr>
									<td colspan="2">
										<em>None found</em>
									</td>
								</tr>
							{% endif %}
						{% endfor %}
					</table>
				</aside>
			</div>

			{% if node.constants|length > 0 %}
				<a id="constants" name="constants"></a>
				<div class="row-fluid">
					<div class="span8 content class">
						<h2>Constants</h2>
					</div>
					<aside class="span4 detailsbar"></aside>
				</div>

				{% for constant in node.inheritedConstants.merge(node.constants) %}
					{{ block('constant') }}
				{% endfor %}
			{% endif %}

			{% if node.inheritedMethods.merge(node.methods)|length > 0 %}
				<div class="row-fluid">
					<div class="span8 content class">
						<h2>Methods</h2>
					</div>
					<aside class="span4 detailsbar"></aside>
				</div>

				{% for method in node.inheritedMethods.merge(node.methods) %}
					{% if method.visibility == 'public' %}
						{{ block('method') }}
					{% endif %}
				{% endfor %}
				{% for method in node.inheritedMethods.merge(node.methods) %}
					{% if method.visibility == 'protected' %}
						{{ block('method') }}
					{% endif %}
				{% endfor %}
				{% for method in node.inheritedMethods.merge(node.methods) %}
					{% if method.visibility == 'private' %}
						{{ block('method') }}
					{% endif %}
				{% endfor %}
			{% endif %}
		</div>
	</section>

	<div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="source-view-label">{{ node.file.name }}</h3>
		</div>
		<div class="modal-body">
			<pre data-src="{{ path('files/' ~ node.path ~ '.txt')|raw }}" class="language-php"></pre>
		</div>
	</div>
{% endblock %}
