{*
ApiGen 2.8.0 - API documentation generator for PHP 5.3+

Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)

For the full copyright and license information, please view
the file LICENSE.md that was distributed with this source code.
*}
{layout '@layout.latte'}
{var $active = 'class'}

{block #title}{if $class->deprecated}Deprecated {/if}{if $class->interface}Interface{elseif $class->trait}Trait{else}Class{/if} {$class->name}{/block}

{block #content}
<div id="content" class="class">
	<h1 n:class="$class->deprecated ? deprecated">{if $class->interface}Interface{elseif $class->trait}Trait{else}Class{/if} {$class->shortName}</h1>

	{if $class->valid}

	<div class="description" n:if="$template->longDescription($class)">
	{!$class|longDescription}
	</div>

	<dl class="tree" n:if="$class->parentClass || $class->ownInterfaces || $class->ownTraits">
		<dd n:foreach="$tree as $item" style="padding-left:{($iterator->counter - 1) * 30}px">
			<img src="resources/inherit.png" alt="Extended by" n:if="$iterator->counter > 1">
			{if $item->documented}
			<a href="{$item|classUrl}" n:tag-if="!$iterator->last">{last}<b>{/last}<span n:class="$item->deprecated ? deprecated, !$item->valid ? invalid">{$item->name}</span>{last}</b>{/last}</a>
			{else}{$item->name}{/if}
			{var $itemOwnInterfaces = $item->ownInterfaces}
			{if $itemOwnInterfaces} implements {foreach $itemOwnInterfaces as $interface}
				<a href="{$interface|classUrl}" n:tag-if="$interface->documented"><span n:class="$interface->deprecated ? deprecated, !$interface->valid ? invalid">{$interface->name}</span></a>{sep}, {/sep}
			{/foreach}{/if}
			{var $itemOwnTraits = $item->ownTraits}
			{if $itemOwnTraits} uses {foreach $itemOwnTraits as $trait}
				<a href="{$trait|classUrl}" n:tag-if="$trait->documented"><span n:class="$trait->deprecated ? deprecated, !$trait->valid ? invalid">{$trait->name}</span></a>{sep}, {/sep}
			{/foreach}{/if}
		</dd>
	</dl>

	{define #children}
		{foreach $children as $child}
			<a href="{$child|classUrl}" n:tag-if="$child->documented"><span n:tag-if="$child->deprecated" class="deprecated">{$child->name}</span></a>{sep}, {/sep}
		{/foreach}
	{/define}

	<div n:if="$directSubClasses">
		<h4>Direct known subclasses</h4>
		{include #children, children => $directSubClasses}
	</div>

	<div n:if="$indirectSubClasses">
		<h4>Indirect known subclasses</h4>
		{include #children, children => $indirectSubClasses}
	</div>

	<div n:if="$directImplementers">
		<h4>Direct known implementers</h4>
		{include #children, children => $directImplementers}
	</div>

	<div n:if="$indirectImplementers">
		<h4>Indirect known implementers</h4>
		{include #children, children => $indirectImplementers}
	</div>

	<div n:if="$directUsers">
		<h4>Direct Known Users</h4>
		{include #children, children => $directUsers}
	</div>

	<div n:if="$indirectUsers">
		<h4>Indirect Known Users</h4>
		{include #children, children => $indirectUsers}
	</div>

	<div class="info">
		{if !$class->interface && !$class->trait && ($class->abstract || $class->final)}<b>{if $class->abstract}Abstract{else}Final{/if}</b><br>{/if}
		{if $class->internal}<b>PHP Extension:</b> <a href="{$class->extension|manualUrl}" title="Go to PHP documentation">{$class->extension->name|firstUpper}</a><br>{/if}
		{if $class->inNamespace()}<b>Namespace:</b> {!$class->namespaceName|namespaceLinks}<br>{/if}
		{if $class->inPackage()}<b>Package:</b> {!$class->packageName|packageLinks}<br>{/if}

		{foreach $template->annotationSort($template->annotationFilter($class->annotations)) as $annotation => $values}
			{foreach $values as $value}
				<b>{$annotation|annotationBeautify}{if $value}:{/if}</b>
				{!$value|annotation:$annotation:$class}<br>
			{/foreach}
		{/foreach}
		{if $class->internal}<b>Documented at</b> <a href="{$class|manualUrl}" title="Go to PHP documentation">php.net</a>{else}<b>Located at</b> <a n:tag-if="$config->sourceCode" href="{$class|sourceUrl}" title="Go to source code">{$class->fileName|relativePath}</a>{/if}<br>
	</div>

	{var $ownMethods = $class->ownMethods}
	{var $ownMagicMethods = $class->ownMagicMethods}

	{define #method}
	<tr data-order="{$method->name}" id="{if $method->magic}m{/if}_{$method->name}">
		{var $annotations = $method->annotations}

		<td class="attributes"><code>
			{if !$class->interface && $method->abstract}abstract{elseif $method->final}final{/if} {if $method->protected}protected{elseif $method->private}private{else}public{/if} {if $method->static}static{/if}
			{ifset $annotations['return']}{!$annotations['return'][0]|typeLinks:$method}{/ifset}
			{if $method->returnsReference()}&amp;{/if}
			</code>
		</td>

		<td class="name"><div>
		<a class="anchor" href="#{if $method->magic}m{/if}_{$method->name}">#</a>
		<code>{block|strip}
			{if $class->internal}
				<a href="{$method|manualUrl}" title="Go to PHP documentation">{$method->name}</a>(
			{else}
				<a n:tag-if="$config->sourceCode" href="{$method|sourceUrl}" title="Go to source code">{$method->name}</a>(
			{/if}
			{foreach $method->parameters as $parameter}
				<span>{!$parameter->typeHint|typeLinks:$method}
				<var>{if $parameter->passedByReference}&amp; {/if}${$parameter->name}</var>{if $parameter->defaultValueAvailable} = {!$parameter->defaultValueDefinition|highlightPHP:$class}{elseif $parameter->unlimited},…{/if}</span>{sep}, {/sep}
			{/foreach}
		){/block}</code>

		{if $config->template['options']['elementDetailsCollapsed']}
		<div class="description short">
			{!$method|shortDescription:true}
		</div>
		{/if}

		<div n:class="description, detailed, $config->template['options']['elementDetailsCollapsed'] ? hidden">
			{!$method|longDescription}

			{if !$class->deprecated && $method->deprecated}
				<h4>Deprecated</h4>
				{ifset $annotations['deprecated']}
				<div class="list">
				{foreach $annotations['deprecated'] as $description}
					{if $description}
						{!$description|annotation:'deprecated':$method}<br>
					{/if}
				{/foreach}
				</div>
				{/ifset}
			{/if}

			{if $method->parameters && isset($annotations['param'])}
				<h4>Parameters</h4>
				<div class="list"><dl>
				{foreach $method->parameters as $parameter}
					<dt><var>${$parameter->name}</var>{if $parameter->unlimited},…{/if}</dt>
					<dd>{ifset $annotations['param'][$parameter->position]}{!$annotations['param'][$parameter->position]|annotation:'param':$method}{/ifset}</dd>
				{/foreach}
				</dl></div>
			{/if}

			{if isset($annotations['return']) && 'void' !== $annotations['return'][0]}
				<h4>Returns</h4>
				<div class="list">
				{foreach $annotations['return'] as $description}
					{!$description|annotation:'return':$method}<br>
				{/foreach}
				</div>
			{/if}

			{ifset $annotations['throws']}
				<h4>Throws</h4>
				<div class="list">
				{foreach $annotations['throws'] as $description}
					{!$description|annotation:'throws':$method}<br>
				{/foreach}
				</div>
			{/ifset}

			{foreach $template->annotationSort($template->annotationFilter($annotations, array('deprecated', 'param', 'return', 'throws'))) as $annotation => $descriptions}
				<h4>{$annotation|annotationBeautify}</h4>
				<div class="list">
				{foreach $descriptions as $description}
					{if $description}
						{!$description|annotation:$annotation:$method}<br>
					{/if}
				{/foreach}
				</div>
			{/foreach}

			{var $overriddenMethod = $method->overriddenMethod}
			{if $overriddenMethod}
				<h4>Overrides</h4>
				<div class="list"><code><a n:tag-if="$template->getClass($overriddenMethod->declaringClassName)" href="{$overriddenMethod|methodUrl}">{$overriddenMethod->prettyName}</a></code></div>
			{/if}

			{var $implementedMethod = $method->implementedMethod}
			{if $implementedMethod}
				<h4>Implementation of</h4>
				<div class="list"><code><a n:tag-if="$template->getClass($implementedMethod->declaringClassName)" href="{$implementedMethod|methodUrl}">{$implementedMethod->prettyName}</a></code></div>
			{/if}
		</div>
		</div></td>
	</tr>
	{/define}

	<table class="summary" id="methods" n:if="$ownMethods">
	<caption>Methods summary</caption>
	{foreach $ownMethods as $method}
		{include #method, method => $method}
	{/foreach}
	</table>

	<table n:foreach="$class->inheritedMethods as $parentName => $methods" class="summary inherited">
	<caption>Methods inherited from <a href="{$parentName|classUrl}#methods" n:tag-if="$template->getClass($parentName)" style="color:#ffffff;">{$parentName}</a></caption>
	<tr>
		<td><code>
		{foreach $methods as $method}
			<a href="{$method|methodUrl}" n:tag-if="$template->getClass($parentName)"><span n:tag-if="$method->deprecated" class="deprecated">{$method->name}()</span></a>{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	<table n:foreach="$class->usedMethods as $traitName => $methods" class="summary used">
	<caption>Methods used from <a href="{$traitName|classUrl}#methods" n:tag-if="$template->getClass($traitName)" style="color:#ffffff;">{$traitName}</a></caption>
	<tr>
		<td><code>
		{foreach $methods as $data}
			<a href="{$data['method']|methodUrl:$data['method']->declaringTrait}" n:tag-if="$template->getClass($traitName)"><span n:tag-if="$data['method']->deprecated" class="deprecated">{$data['method']->originalName}()</span></a>{if $data['aliases']}(as {foreach $data['aliases'] as $alias}<span n:tag-if="$data['method']->deprecated" class="deprecated">{$alias->name}()</span>{sep}, {/sep}{/foreach}){/if}{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	<table class="summary" id="methods" n:if="$ownMagicMethods">
	<caption>Magic methods summary</caption>
	{foreach $ownMagicMethods as $method}
		{include #method, method => $method}
	{/foreach}
	</table>

	<table n:foreach="$class->inheritedMagicMethods as $parentName => $methods" class="summary inherited">
	<caption>Magic methods inherited from <a href="{$parentName|classUrl}#methods" n:tag-if="$template->getClass($parentName)" style="color:#ffffff;">{$parentName}</a></caption>
	<tr>
		<td><code>
		{foreach $methods as $method}
			<a href="{$method|methodUrl}" n:tag-if="$template->getClass($parentName)"><span n:tag-if="$method->deprecated" class="deprecated">{$method->name}()</span></a>{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	<table n:foreach="$class->usedMagicMethods as $traitName => $methods" class="summary used">
	<caption>Magic methods used from <a href="{$traitName|classUrl}#methods" n:tag-if="$template->getClass($traitName)" style="color:#ffffff;">{$traitName}</a></caption>
	<tr>
		<td><code>
		{foreach $methods as $data}
			<a href="{$data['method']|methodUrl:$data['method']->declaringTrait}" n:tag-if="$template->getClass($traitName)"><span n:tag-if="$data['method']->deprecated" class="deprecated">{$data['method']->originalName}()</span></a>{if $data['aliases']}(as {foreach $data['aliases'] as $alias}<span n:tag-if="$data['method']->deprecated" class="deprecated">{$alias->name}()</span>{sep}, {/sep}{/foreach}){/if}{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>


	{var $ownConstants = $class->ownConstants}

	<table class="summary" id="constants" n:if="$ownConstants">
	<caption>Constants summary</caption>
	<tr n:foreach="$ownConstants as $constant" data-order="{$constant->name}" id="{$constant->name}">
		{var $annotations = $constant->annotations}

		<td class="attributes"><code>{!$constant->typeHint|typeLinks:$constant}</code></td>
		<td class="name"><code>
			{if $class->internal}
				<a href="{$constant|manualUrl}" title="Go to PHP documentation"><b>{$constant->name}</b></a>
			{else}
				<a n:tag-if="$config->sourceCode" href="{$constant|sourceUrl}" title="Go to source code"><b>{$constant->name}</b></a>
			{/if}
		</code></td>
		<td class="value"><code>{!$constant->valueDefinition|highlightValue:$class}</code></td>
		<td class="description"><div>
			<a href="#{$constant->name}" class="anchor">#</a>

			{if $config->template['options']['elementDetailsCollapsed']}
			<div class="description short">
				{!$constant|shortDescription:true}
			</div>
			{/if}

			<div n:class="description, detailed, $config->template['options']['elementDetailsCollapsed'] ? hidden">
				{!$constant|longDescription}

				{foreach $template->annotationSort($template->annotationFilter($annotations, array('var'))) as $annotation => $descriptions}
					<h4>{$annotation|annotationBeautify}</h4>
					<div class="list">
					{foreach $descriptions as $description}
						{if $description}
							{!$description|annotation:$annotation:$constant}<br>
						{/if}
					{/foreach}
					</div>
				{/foreach}
			</div>
		</div></td>
	</tr>
	</table>

	<table n:foreach="$class->inheritedConstants as $parentName => $constants" class="summary inherited">
	<caption>Constants inherited from <a href="{$parentName|classUrl}#constants" n:tag-if="$template->getClass($parentName)">{$parentName}</a></caption>
	<tr>
		<td><code>
		{foreach $constants as $constant}
			<a href="{$constant|constantUrl}" n:tag-if="$template->getClass($parentName)"><b><span n:tag-if="$constant->deprecated" class"deprecated">{$constant->name}</span></b></a>{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	{define #property}
	<tr data-order="{$property->name}" id="{if $property->magic}m{/if}${$property->name}">
		<td class="attributes"><code>
			{if $property->protected}protected{elseif $property->private}private{else}public{/if} {if $property->static}static{/if} {if $property->readOnly}read-only{elseif $property->writeOnly}write-only{/if}
			{!$property->typeHint|typeLinks:$property}
		</code></td>

		<td class="name">
			{if $class->internal}
				<a href="{$property|manualUrl}" title="Go to PHP documentation"><var>${$property->name}</var></a>
			{else}
				<a n:tag-if="$config->sourceCode" href="{$property|sourceUrl}" title="Go to source code"><var>${$property->name}</var></a>
			{/if}
		</td>
		<td n:if="!$property->magic" class="value"><code>{!$property->defaultValueDefinition|highlightValue:$class}</code></td>
		<td class="description"><div>
			<a href="#{if $property->magic}m{/if}${$property->name}" class="anchor">#</a>

			{if $config->template['options']['elementDetailsCollapsed']}
			<div class="description short">
				{!$property|shortDescription:true}
			</div>
			{/if}

			<div n:class="description, detailed, $config->template['options']['elementDetailsCollapsed'] ? hidden">
				{!$property|longDescription}

				{foreach $template->annotationSort($template->annotationFilter($property->annotations, array('var'))) as $annotation => $descriptions}
					<h4>{$annotation|annotationBeautify}</h4>
					<div class="list">
					{foreach $descriptions as $description}
						{if $description}
							{!$description|annotation:$annotation:$property}<br>
						{/if}
					{/foreach}
					</div>
				{/foreach}
			</div>
		</div></td>
	</tr>
	{/define}

	{var $ownProperties = $class->ownProperties}
	{var $ownMagicProperties = $class->ownMagicProperties}

	<table class="summary" id="properties" n:if="$ownProperties">
	<caption>Properties summary</caption>
	{foreach $ownProperties as $property}
		{include #property, property => $property}
	{/foreach}
	</table>

	<table n:foreach="$class->inheritedProperties as $parentName => $properties" class="summary inherited">
	<caption>Properties inherited from <a href="{$parentName|classUrl}#properties" n:tag-if="$template->getClass($parentName)" style="color:#ffffff;">{$parentName}</a></caption>
	<tr>
		<td><code>
		{foreach $properties as $property}
			<a href="{$property|propertyUrl}" n:tag-if="$template->getClass($parentName)"><var><span n:tag-if="$property->deprecated" class="deprecated">${$property->name}</span></var></a>{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	<table n:foreach="$class->usedProperties as $traitName => $properties" class="summary used">
	<caption>Properties used from <a href="{$traitName|classUrl}#properties" n:tag-if="$template->getClass($traitName)" style="color:#ffffff;">{$traitName}</a></caption>
	<tr>
		<td><code>
		{foreach $properties as $property}
			<a href="{$property|propertyUrl:$property->declaringTrait}" n:tag-if="$template->getClass($traitName)"><var><span n:tag-if="$property->deprecated" class="deprecated">${$property->name}</span></var></a>{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	<table class="summary" id="magicProperties" n:if="$ownMagicProperties">
	<caption>Magic properties summary</caption>
	{foreach $ownMagicProperties as $property}
		{include #property, property => $property}
	{/foreach}
	</table>

	<table n:foreach="$class->inheritedMagicProperties as $parentName => $properties" class="summary inherited">
	<caption>Magic properties inherited from <a href="{$parentName|classUrl}#properties" n:tag-if="$template->getClass($parentName)" style="color:#ffffff;">{$parentName}</a></caption>
	<tr>
		<td><code>
		{foreach $properties as $property}
			<a href="{$property|propertyUrl}" n:tag-if="$template->getClass($parentName)"><var><span n:tag-if="$property->deprecated" class="deprecated">${$property->name}</span></var></a>{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	<table n:foreach="$class->usedMagicProperties as $traitName => $properties" class="summary used">
	<caption>Magic properties used from <a href="{$traitName|classUrl}#properties" n:tag-if="$template->getClass($traitName)" style="color:#ffffff;">{$traitName}</a></caption>
	<tr>
		<td><code>
		{foreach $properties as $property}
			<a href="{$property|propertyUrl:$property->declaringTrait}" n:tag-if="$template->getClass($traitName)"><var><span n:tag-if="$property->deprecated" class="deprecated">${$property->name}</span></var></a>{sep}, {/sep}
		{/foreach}
		</code></td>
	</tr>
	</table>

	{else}
		<div class="invalid">
			<p>
				Documentation of this class could not be generated.
			</p>
			<p>
				Class was originally declared in {$class->fileName|relativePath} and is invalid because of:
			</p>
			<ul>
				<li n:foreach="$class->reasons as $reason">Class was redeclared in {$reason->getSender()->getFileName()|relativePath}.</li>
			</ul>
		</div>
	{/if}
</div>
{/block}
