PageRenderTime 52ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/templates/default/class.latte

https://bitbucket.org/gencer/apigen
Unknown | 421 lines | 365 code | 56 blank | 0 comment | 0 complexity | 14fc81787eb142e9a7d88aaca8a587c8 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. {*
  2. ApiGen 3.0dev - API documentation generator for PHP 5.3+
  3. Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com)
  4. Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich)
  5. Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville)
  6. For the full copyright and license information, please view
  7. the file LICENSE.md that was distributed with this source code.
  8. *}
  9. {layout '@layout.latte'}
  10. {var $active = 'class'}
  11. {block #title}{if $class->deprecated}Deprecated {/if}{if $class->interface}Interface{elseif $class->trait}Trait{else}Class{/if} {$class->name}{/block}
  12. {block #content}
  13. <div id="content" class="class">
  14. <h1 n:class="$class->deprecated ? deprecated">{if $class->interface}Interface{elseif $class->trait}Trait{else}Class{/if} {$class->shortName}</h1>
  15. {if $class->valid}
  16. <div class="description" n:if="$template->longDescription($class)">
  17. {!$class|longDescription}
  18. </div>
  19. <dl class="tree" n:if="$class->parentClass || $class->ownInterfaces || $class->ownTraits">
  20. <dd n:foreach="$tree as $item" style="padding-left:{($iterator->counter - 1) * 30}px">
  21. <img src="resources/inherit.png" alt="Extended by" n:if="$iterator->counter > 1">
  22. {if $item->documented}
  23. <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>
  24. {else}{$item->name}{/if}
  25. {var $itemOwnInterfaces = $item->ownInterfaces}
  26. {if $itemOwnInterfaces} implements {foreach $itemOwnInterfaces as $interface}
  27. <a href="{$interface|classUrl}" n:tag-if="$interface->documented"><span n:class="$interface->deprecated ? deprecated, !$interface->valid ? invalid">{$interface->name}</span></a>{sep}, {/sep}
  28. {/foreach}{/if}
  29. {var $itemOwnTraits = $item->ownTraits}
  30. {if $itemOwnTraits} uses {foreach $itemOwnTraits as $trait}
  31. <a href="{$trait|classUrl}" n:tag-if="$trait->documented"><span n:class="$trait->deprecated ? deprecated, !$trait->valid ? invalid">{$trait->name}</span></a>{sep}, {/sep}
  32. {/foreach}{/if}
  33. </dd>
  34. </dl>
  35. {define #children}
  36. {foreach $children as $child}
  37. <a href="{$child|classUrl}" n:tag-if="$child->documented"><span n:tag-if="$child->deprecated" class="deprecated">{$child->name}</span></a>{sep}, {/sep}
  38. {/foreach}
  39. {/define}
  40. <div n:if="$directSubClasses">
  41. <h4>Direct known subclasses</h4>
  42. {include #children, children => $directSubClasses}
  43. </div>
  44. <div n:if="$indirectSubClasses">
  45. <h4>Indirect known subclasses</h4>
  46. {include #children, children => $indirectSubClasses}
  47. </div>
  48. <div n:if="$directImplementers">
  49. <h4>Direct known implementers</h4>
  50. {include #children, children => $directImplementers}
  51. </div>
  52. <div n:if="$indirectImplementers">
  53. <h4>Indirect known implementers</h4>
  54. {include #children, children => $indirectImplementers}
  55. </div>
  56. <div n:if="$directUsers">
  57. <h4>Direct Known Users</h4>
  58. {include #children, children => $directUsers}
  59. </div>
  60. <div n:if="$indirectUsers">
  61. <h4>Indirect Known Users</h4>
  62. {include #children, children => $indirectUsers}
  63. </div>
  64. <div class="info">
  65. {if !$class->interface && !$class->trait && ($class->abstract || $class->final)}<b>{if $class->abstract}Abstract{else}Final{/if}</b><br>{/if}
  66. {if $class->internal}<b>PHP Extension:</b> <a href="{$class->extension|manualUrl}" title="Go to PHP documentation">{$class->extension->name|firstUpper}</a><br>{/if}
  67. {if $class->inNamespace()}<b>Namespace:</b> {!$class->namespaceName|namespaceLinks}<br>{/if}
  68. {if $class->inPackage()}<b>Package:</b> {!$class->packageName|packageLinks}<br>{/if}
  69. {foreach $template->annotationSort($template->annotationFilter($class->annotations)) as $annotation => $values}
  70. {foreach $values as $value}
  71. <b>{$annotation|annotationBeautify}{if $value}:{/if}</b>
  72. {!$value|annotation:$annotation:$class}<br>
  73. {/foreach}
  74. {/foreach}
  75. {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>
  76. </div>
  77. {var $ownMethods = $class->ownMethods}
  78. {var $ownMagicMethods = $class->ownMagicMethods}
  79. {define #method}
  80. <tr data-order="{$method->name}" id="{if $method->magic}m{/if}_{$method->name}">
  81. {var $annotations = $method->annotations}
  82. <td class="attributes"><code>
  83. {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}
  84. {ifset $annotations['return']}{!$annotations['return'][0]|typeLinks:$method}{/ifset}
  85. {if $method->returnsReference()}&amp;{/if}
  86. </code>
  87. </td>
  88. <td class="name"><div>
  89. <a class="anchor" href="#{if $method->magic}m{/if}_{$method->name}">#</a>
  90. <code>{block|strip}
  91. {if $class->internal}
  92. <a href="{$method|manualUrl}" title="Go to PHP documentation">{$method->name}</a>(
  93. {else}
  94. <a n:tag-if="$config->sourceCode" href="{$method|sourceUrl}" title="Go to source code">{$method->name}</a>(
  95. {/if}
  96. {foreach $method->parameters as $parameter}
  97. <span>{!$parameter->typeHint|typeLinks:$method}
  98. <var>{if $parameter->passedByReference}&amp; {/if}${$parameter->name}</var>{if $parameter->defaultValueAvailable} = {!$parameter->defaultValueDefinition|highlightPHP:$class}{elseif $parameter->unlimited},{/if}</span>{sep}, {/sep}
  99. {/foreach}
  100. ){/block}</code>
  101. {if $config->template['options']['elementDetailsCollapsed']}
  102. <div class="description short">
  103. {!$method|shortDescription:true}
  104. </div>
  105. {/if}
  106. <div n:class="description, detailed, $config->template['options']['elementDetailsCollapsed'] ? hidden">
  107. {!$method|longDescription}
  108. {if !$class->deprecated && $method->deprecated}
  109. <h4>Deprecated</h4>
  110. {ifset $annotations['deprecated']}
  111. <div class="list">
  112. {foreach $annotations['deprecated'] as $description}
  113. {if $description}
  114. {!$description|annotation:'deprecated':$method}<br>
  115. {/if}
  116. {/foreach}
  117. </div>
  118. {/ifset}
  119. {/if}
  120. {if $method->parameters && isset($annotations['param'])}
  121. <h4>Parameters</h4>
  122. <div class="list"><dl>
  123. {foreach $method->parameters as $parameter}
  124. <dt><var>${$parameter->name}</var>{if $parameter->unlimited},{/if}</dt>
  125. <dd>{$parameter->description|description:$method}</dd>
  126. {/foreach}
  127. </dl></div>
  128. {/if}
  129. {if isset($annotations['return']) && 'void' !== $annotations['return'][0]}
  130. <h4>Returns</h4>
  131. <div class="list">
  132. {foreach $annotations['return'] as $description}
  133. {!$description|annotation:'return':$method}<br>
  134. {/foreach}
  135. </div>
  136. {/if}
  137. {ifset $annotations['throws']}
  138. <h4>Throws</h4>
  139. <div class="list">
  140. {foreach $annotations['throws'] as $description}
  141. {!$description|annotation:'throws':$method}<br>
  142. {/foreach}
  143. </div>
  144. {/ifset}
  145. {foreach $template->annotationSort($template->annotationFilter($annotations, array('deprecated', 'param', 'return', 'throws'))) as $annotation => $descriptions}
  146. <h4>{$annotation|annotationBeautify}</h4>
  147. <div class="list">
  148. {foreach $descriptions as $description}
  149. {if $description}
  150. {!$description|annotation:$annotation:$method}<br>
  151. {/if}
  152. {/foreach}
  153. </div>
  154. {/foreach}
  155. {var $overriddenMethod = $method->overriddenMethod}
  156. {if $overriddenMethod}
  157. <h4>Overrides</h4>
  158. <div class="list"><code><a n:tag-if="$template->getClass($overriddenMethod->declaringClassName)" href="{$overriddenMethod|methodUrl}">{$overriddenMethod->prettyName}</a></code></div>
  159. {/if}
  160. {var $implementedMethod = $method->implementedMethod}
  161. {if $implementedMethod}
  162. <h4>Implementation of</h4>
  163. <div class="list"><code><a n:tag-if="$template->getClass($implementedMethod->declaringClassName)" href="{$implementedMethod|methodUrl}">{$implementedMethod->prettyName}</a></code></div>
  164. {/if}
  165. </div>
  166. </div></td>
  167. </tr>
  168. {/define}
  169. <table class="summary methods" id="methods" n:if="$ownMethods">
  170. <caption>Methods summary</caption>
  171. {foreach $ownMethods as $method}
  172. {include #method, method => $method}
  173. {/foreach}
  174. </table>
  175. <table n:foreach="$class->inheritedMethods as $parentName => $methods" class="summary inherited">
  176. <caption>Methods inherited from <a href="{$parentName|classUrl}#methods" n:tag-if="$template->getClass($parentName)">{$parentName}</a></caption>
  177. <tr>
  178. <td><code>
  179. {foreach $methods as $method}
  180. <a href="{$method|methodUrl}" n:tag-if="$template->getClass($parentName)"><span n:tag-if="$method->deprecated" class="deprecated">{$method->name}()</span></a>{sep}, {/sep}
  181. {/foreach}
  182. </code></td>
  183. </tr>
  184. </table>
  185. <table n:foreach="$class->usedMethods as $traitName => $methods" class="summary used">
  186. <caption>Methods used from <a href="{$traitName|classUrl}#methods" n:tag-if="$template->getClass($traitName)">{$traitName}</a></caption>
  187. <tr>
  188. <td><code>
  189. {foreach $methods as $data}
  190. <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}
  191. {/foreach}
  192. </code></td>
  193. </tr>
  194. </table>
  195. <table class="summary methods" id="magicMethods" n:if="$ownMagicMethods">
  196. <caption>Magic methods summary</caption>
  197. {foreach $ownMagicMethods as $method}
  198. {include #method, method => $method}
  199. {/foreach}
  200. </table>
  201. <table n:foreach="$class->inheritedMagicMethods as $parentName => $methods" class="summary inherited">
  202. <caption>Magic methods inherited from <a href="{$parentName|classUrl}#methods" n:tag-if="$template->getClass($parentName)">{$parentName}</a></caption>
  203. <tr>
  204. <td><code>
  205. {foreach $methods as $method}
  206. <a href="{$method|methodUrl}" n:tag-if="$template->getClass($parentName)"><span n:tag-if="$method->deprecated" class="deprecated">{$method->name}()</span></a>{sep}, {/sep}
  207. {/foreach}
  208. </code></td>
  209. </tr>
  210. </table>
  211. <table n:foreach="$class->usedMagicMethods as $traitName => $methods" class="summary used">
  212. <caption>Magic methods used from <a href="{$traitName|classUrl}#methods" n:tag-if="$template->getClass($traitName)">{$traitName}</a></caption>
  213. <tr>
  214. <td><code>
  215. {foreach $methods as $data}
  216. <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}
  217. {/foreach}
  218. </code></td>
  219. </tr>
  220. </table>
  221. {var $ownConstants = $class->ownConstants}
  222. <table class="summary constants" id="constants" n:if="$ownConstants">
  223. <caption>Constants summary</caption>
  224. <tr n:foreach="$ownConstants as $constant" data-order="{$constant->name}" id="{$constant->name}">
  225. {var $annotations = $constant->annotations}
  226. <td class="attributes"><code>{!$constant->typeHint|typeLinks:$constant}</code></td>
  227. <td class="name">
  228. <code>
  229. {if $class->internal}
  230. <a href="{$constant|manualUrl}" title="Go to PHP documentation"><b>{$constant->name}</b></a>
  231. {else}
  232. <a n:tag-if="$config->sourceCode" href="{$constant|sourceUrl}" title="Go to source code"><b>{$constant->name}</b></a>
  233. {/if}
  234. </code>
  235. <div n:if="$config->template->options->elementDetailsCollapsed" class="description short">
  236. {!$constant|shortDescription:true}
  237. </div>
  238. <div n:class="description, detailed, $config->template->options->elementDetailsCollapsed ? hidden">
  239. {!$constant|longDescription}
  240. {foreach $template->annotationSort($template->annotationFilter($annotations, array('var'))) as $annotation => $descriptions}
  241. <h4>{$annotation|annotationBeautify}</h4>
  242. <div class="list">
  243. {foreach $descriptions as $description}
  244. {if $description}
  245. {!$description|annotation:$annotation:$constant}<br>
  246. {/if}
  247. {/foreach}
  248. </div>
  249. {/foreach}
  250. </div>
  251. </td>
  252. <td class="value"><div><a href="#{$constant->name}" class="anchor">#</a><code>{!$constant->valueDefinition|highlightValue:$class}</code></div></td>
  253. </tr>
  254. </table>
  255. <table n:foreach="$class->inheritedConstants as $parentName => $constants" class="summary inherited">
  256. <caption>Constants inherited from <a href="{$parentName|classUrl}#constants" n:tag-if="$template->getClass($parentName)">{$parentName}</a></caption>
  257. <tr>
  258. <td><code>
  259. {foreach $constants as $constant}
  260. <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}
  261. {/foreach}
  262. </code></td>
  263. </tr>
  264. </table>
  265. {define #property}
  266. <tr data-order="{$property->name}" id="{if $property->magic}m{/if}${$property->name}">
  267. <td class="attributes"><code>
  268. {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}
  269. {!$property->typeHint|typeLinks:$property}
  270. </code></td>
  271. <td class="name">
  272. {if $class->internal}
  273. <a href="{$property|manualUrl}" title="Go to PHP documentation"><var>${$property->name}</var></a>
  274. {else}
  275. <a n:tag-if="$config->sourceCode" href="{$property|sourceUrl}" title="Go to source code"><var>${$property->name}</var></a>
  276. {/if}
  277. <div n:if="$config->template->options->elementDetailsCollapsed" class="description short">
  278. {!$property|shortDescription:true}
  279. </div>
  280. <div n:class="description, detailed, $config->template->options->elementDetailsCollapsed ? hidden">
  281. {!$property|longDescription}
  282. {foreach $template->annotationSort($template->annotationFilter($property->annotations, array('var'))) as $annotation => $descriptions}
  283. <h4>{$annotation|annotationBeautify}</h4>
  284. <div class="list">
  285. {foreach $descriptions as $description}
  286. {if $description}
  287. {!$description|annotation:$annotation:$property}<br>
  288. {/if}
  289. {/foreach}
  290. </div>
  291. {/foreach}
  292. </div>
  293. </td>
  294. <td n:if="!$property->magic" class="value"><div><a href="#{if $property->magic}m{/if}${$property->name}" class="anchor">#</a><code>{!$property->defaultValueDefinition|highlightValue:$class}</code></div></td>
  295. </tr>
  296. {/define}
  297. {var $ownProperties = $class->ownProperties}
  298. {var $ownMagicProperties = $class->ownMagicProperties}
  299. <table class="summary properties" id="properties" n:if="$ownProperties">
  300. <caption>Properties summary</caption>
  301. {foreach $ownProperties as $property}
  302. {include #property, property => $property}
  303. {/foreach}
  304. </table>
  305. <table n:foreach="$class->inheritedProperties as $parentName => $properties" class="summary inherited">
  306. <caption>Properties inherited from <a href="{$parentName|classUrl}#properties" n:tag-if="$template->getClass($parentName)">{$parentName}</a></caption>
  307. <tr>
  308. <td><code>
  309. {foreach $properties as $property}
  310. <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}
  311. {/foreach}
  312. </code></td>
  313. </tr>
  314. </table>
  315. <table n:foreach="$class->usedProperties as $traitName => $properties" class="summary used">
  316. <caption>Properties used from <a href="{$traitName|classUrl}#properties" n:tag-if="$template->getClass($traitName)">{$traitName}</a></caption>
  317. <tr>
  318. <td><code>
  319. {foreach $properties as $property}
  320. <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}
  321. {/foreach}
  322. </code></td>
  323. </tr>
  324. </table>
  325. <table class="summary properties" id="magicProperties" n:if="$ownMagicProperties">
  326. <caption>Magic properties summary</caption>
  327. {foreach $ownMagicProperties as $property}
  328. {include #property, property => $property}
  329. {/foreach}
  330. </table>
  331. <table n:foreach="$class->inheritedMagicProperties as $parentName => $properties" class="summary inherited">
  332. <caption>Magic properties inherited from <a href="{$parentName|classUrl}#properties" n:tag-if="$template->getClass($parentName)">{$parentName}</a></caption>
  333. <tr>
  334. <td><code>
  335. {foreach $properties as $property}
  336. <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}
  337. {/foreach}
  338. </code></td>
  339. </tr>
  340. </table>
  341. <table n:foreach="$class->usedMagicProperties as $traitName => $properties" class="summary used">
  342. <caption>Magic properties used from <a href="{$traitName|classUrl}#properties" n:tag-if="$template->getClass($traitName)">{$traitName}</a></caption>
  343. <tr>
  344. <td><code>
  345. {foreach $properties as $property}
  346. <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}
  347. {/foreach}
  348. </code></td>
  349. </tr>
  350. </table>
  351. {else}
  352. <div class="invalid">
  353. <p>
  354. Documentation of this class could not be generated.
  355. </p>
  356. <p>
  357. Class was originally declared in {$class->fileName|relativePath} and is invalid because of:
  358. </p>
  359. <ul>
  360. <li n:foreach="$class->reasons as $reason">Class was redeclared in {$reason->getSender()->getFileName()|relativePath}.</li>
  361. </ul>
  362. </div>
  363. {/if}
  364. </div>
  365. {/block}