forked from phpDocumentor/template.clean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.html.twig
324 lines (294 loc) · 15.9 KB
/
class.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
{% extends 'layout.html.twig' %}
{% block javascripts %}
<script type="text/javascript">
function loadExternalCodeSnippets() {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) {
var src = pre.getAttribute('data-src');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist or is empty';
}
}
};
xhr.send(null);
});
}
$(document).ready(function(){
loadExternalCodeSnippets();
});
$('#source-view').on('shown', function () {
loadExternalCodeSnippets();
})
</script>
{% endblock %}
{% 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">« NamespaceAssembler</a>#}
{{ node.namespace|route|raw }} <i class="icon-level-up"></i>
{#<a href="" class="pull-right">ClassAssembler »</a>#}
</nav>
<a href="#source-view" role="button" class="pull-right btn" data-toggle="modal"><i class="icon-code"></i></a>
<h1><small>{{ node.namespace }}</small>{{ node.name }}</h1>
<p><em>{{ node.summary }}</em></p>
{{ node.description|markdown|raw }}
{% for tagName,tags in node.tags if tagName in ['example'] %}
{% if loop.first %}
<h3>Examples</h3>
{% endif %}
{% for tag in tags %}
<h4>{{ tag.description|escape }}</h4>
<pre class="pre-scrollable">{{ tag.example|escape }}</pre>
{% endfor %}
{% endfor %}
<section id="summary">
<h2>Summary</h2>
<section class="row-fluid heading">
<section class="span4">
<a href="#methods">Methods</a>
</section>
<section class="span4">
<a href="#properties">Properties</a>
</section>
<section class="span4">
<a href="#constants">Constants</a>
</section>
</section>
<section class="row-fluid public">
<section class="span4">
{% for method in node.inheritedMethods.merge(node.methods.merge(node.magicMethods)) if method.visibility == 'public' %}
<a href="{{ method|route('url')}}" class="{{ method.deprecated ? 'deprecated' }}">{{ method.name }}()</a><br />
{% else %}
<em>No public methods found</em>
{% endfor %}
</section>
<section class="span4">
{% for property in node.inheritedProperties.merge(node.properties.merge(node.magicProperties)) if property.visibility == 'public' %}
<a href="{{ property|route('url')}}" class="{{ property.deprecated ? 'deprecated' }}">${{ property.name }}</a><br />
{% else %}
<em>No public properties found</em>
{% endfor %}
</section>
<section class="span4">
{% for constant in node.inheritedConstants.merge(node.constants) %}
<a href="{{ constant|route('url')}}" class="{{ constant.deprecated ? 'deprecated' }}">{{ constant.name }}</a><br />
{% else %}
<em>No constants found</em>
{% endfor %}
</section>
</section>
<section class="row-fluid protected">
<section class="span4">
{% for method in node.inheritedMethods.merge(node.methods.merge(node.magicMethods)) if method.visibility == 'protected' %}
<a href="{{ method|route('url')}}" class="{{ method.deprecated ? 'deprecated' }}">{{ method.name }}()</a><br />
{% else %}
<em>No protected methods found</em>
{% endfor %}
</section>
<section class="span4">
{% for property in node.inheritedProperties.merge(node.properties.merge(node.magicProperties)) if property.visibility == 'protected' %}
<a href="{{ property|route('url')}}" class="{{ property.deprecated ? 'deprecated' }}">${{ property.name }}</a><br />
{% else %}
<em>No protected properties found</em>
{% endfor %}
</section>
<section class="span4">
<em>N/A</em>
</section>
</section>
<section class="row-fluid private">
<section class="span4">
{% for method in node.inheritedMethods.merge(node.methods.merge(node.magicMethods)) if method.visibility == 'private' %}
<a href="{{ method|route('url')}}" class="{{ method.deprecated ? 'deprecated' }}">{{ method.name }}()</a><br />
{% else %}
<em>No private methods found</em>
{% endfor %}
</section>
<section class="span4">
{% for property in node.inheritedProperties.merge(node.properties.merge(node.magicProperties)) if property.visibility == 'private' %}
<a href="{{ property|route('url')}}" class="{{ property.deprecated ? 'deprecated' }}">${{ property.name }}</a><br />
{% else %}
<em>No private properties found</em>
{% endfor %}
</section>
<section class="span4">
<em>N/A</em>
</section>
</section>
</section>
</div>
<aside class="span4 detailsbar">
{% if node.abstract %}
<span class="label label-info">abstract</span>
{% endif %}
{% if node.final %}
<span class="label label-info">final</span>
{% endif %}
{% if method.deprecated %}
<aside class="alert alert-block alert-error">
<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.name is not empty and node.package.name != '\\' %}
<dt>Package</dt>
<dd><div class="namespace-wrapper">{{ node.package.parent.name != '\\' ? (node.package.parent.name ~ '\\' ~ node.package.name) : node.package.name }}</div></dd>
{% endif %}
<dt>Class hierarchy</dt>
<dd class="hierarchy">
{% set class = node.parent %}
{% block hierarchy_element %}
{% if class %}
{% set child = class %}
{% set class = class.parent %}
{{ block('hierarchy_element') }}
<div class="namespace-wrapper">{{ child|route|raw }}</div>
{% endif %}
{% endblock %}
<div class="namespace-wrapper">{{ node.fullyQualifiedStructuralElementName}}</div>
</dd>
{% for interface in node.interfaces %}
{% if loop.first %}
<dt>Implements</dt>
{% endif %}
<dd><a href="{{ interface|route('url') }}"><div class="namespace-wrapper">{{ interface.fullyQualifiedStructuralElementName }}</div></a></dd>
{% endfor %}
{% for trait in node.usedTraits %}
{% if loop.first %}
<dt>Uses traits</dt>
{% endif %}
<dd>
{% if trait.fullyQualifiedStructuralElementName %}<a href="{{ trait|route('url') }}">{% endif %}
<div class="namespace-wrapper">{{ trait.fullyQualifiedStructuralElementName ?: trait }}</div>
{% if trait.fullyQualifiedStructuralElementName %}</a>{% endif %}
</dd>
{% endfor %}
{# TODO: expensive action; replace with an index or precompiled list in descriptors #}
{#
{% for child in project.indexes.elements if child.parent.fullyQualifiedStructuralElementName == node.fullyQualifiedStructuralElementName %}
{% if loop.first %}
<dt>Children</dt>
{% endif %}
<dd><a href="{{ child|route('url') }}"><div class="namespace-wrapper">{{ child.fullyQualifiedStructuralElementName }}</div></a></dd>
{% endfor %}
#}
{% for tagName,tags in node.tags if tagName in ['link', 'see'] %}
{% if loop.first %}
<dt>See also</dt>
{% endif %}
{% for tag in tags %}
<dd><a href="{{ tag.link }}"><div class="namespace-wrapper">{{ tag.description }}</div></a></dd>
{% endfor %}
{% endfor %}
{#<dt>Categories</dt>#}
{#<dd><a href="">Assemblers</a></dd>#}
</dl>
<h2>Tags</h2>
<table class="table table-condensed">
{% for tagName,tags in node.tags if tagName not in ['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage'] %}
<tr>
<th>
{{ tagName }}
</th>
<td>
{% for tag in tags %}
{{ tag.description|markdown|raw }}
{% endfor %}
</td>
</tr>
{% else %}
<tr><td colspan="2"><em>None found</em></td></tr>
{% endfor %}
</table>
</aside>
</div>
{% set constants = node.inheritedConstants.merge(node.constants) %}
{% if 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 constants %}
{{ block('constant') }}
{% endfor %}
{% endif %}
{% set properties = node.inheritedProperties.merge(node.properties.merge(node.magicProperties)) %}
{% if properties|length > 0 %}
<a id="properties" name="properties"></a>
<div class="row-fluid">
<div class="span8 content class">
<h2>Properties</h2>
</div>
<aside class="span4 detailsbar"></aside>
</div>
{% for property in properties if property.visibility == 'public' %}
{{ block('property') }}
{% endfor %}
{% for property in properties if property.visibility == 'protected' %}
{{ block('property') }}
{% endfor %}
{% for property in properties if property.visibility == 'private' %}
{{ block('property') }}
{% endfor %}
{% endif %}
{% set methods = node.inheritedMethods.merge(node.methods.merge(node.magicMethods)) %}
{% if methods|length > 0 %}
<a id="methods" name="methods"></a>
<div class="row-fluid">
<div class="span8 content class"><h2>Methods</h2></div>
<aside class="span4 detailsbar"></aside>
</div>
{% for method in methods if method.visibility == 'public' %}
{{ block('method') }}
{% endfor %}
{% for method in methods if method.visibility == 'protected' %}
{{ block('method') }}
{% endfor %}
{% for method in methods if method.visibility == 'private' %}
{{ block('method') }}
{% 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 line-numbers"></pre>
</div>
</div>
{% endblock %}