File: index.xsl

package info (click to toggle)
phpdox 0.12.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 7,672 kB
  • sloc: xml: 80,724; php: 9,167; makefile: 13
file content (324 lines) | stat: -rw-r--r-- 17,483 bytes parent folder | download | duplicates (3)
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
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:pdx="http://xml.phpdox.net/src"
                xmlns:pdxf="http://xml.phpdox.net/functions"
                xmlns:pu="http://schema.phpunit.de/coverage/1.0"
                xmlns:func="http://exslt.org/functions"
                xmlns:idx="http://xml.phpdox.net/src"
                xmlns:git="http://xml.phpdox.net/gitlog"
                xmlns:ctx="ctx://engine/html"
                extension-element-prefixes="func"
                exclude-result-prefixes="idx pdx pdxf pu git ctx">

    <xsl:import href="functions.xsl"/>
    <xsl:import href="components.xsl" />

    <xsl:output method="xml" indent="yes" encoding="UTF-8" doctype-system="about:legacy-compat" />

    <xsl:template match="/">
        <html lang="en">
            <xsl:call-template name="head" />
            <body>
                <xsl:call-template name="nav" />
                <xsl:call-template name="index" />
                <div id="mainstage">
                    <xsl:choose>
                        <xsl:when test="//pdx:enrichment[@type='phploc']">
                            <xsl:call-template name="phploc" />
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:call-template name="missing" />
                        </xsl:otherwise>
                    </xsl:choose>
                </div>
                <xsl:call-template name="footer" />
            </body>
        </html>
    </xsl:template>

    <xsl:template name="index">
        <div id="index">
            <div id="projectinfo">
                <h1><xsl:value-of select="$project" /></h1>
                <h2>Software Documentation</h2>
                <p>Welcome to the Software Documentation homepage.</p>
            </div>
            <div id="buildinfo">
                <h3>Build</h3>
                <p><xsl:value-of select="//pdx:enrichment[@type='build']/pdx:date/@rfc" /></p>
                <h3>VCS Info</h3>
                <p>
                    <xsl:variable name="current" select="//pdx:enrichment[@type='git']/git:current" />
                    tag: <xsl:value-of select="$current/@describe" /><br/>
                    branch: <xsl:value-of select="$current/@branch" />
                </p>
                <h3>Used Enrichers</h3>
                <p>
                    <xsl:for-each select="//pdx:enrichment[@type='build']//pdx:enricher">
                        <xsl:sort select="@type" />
                        <xsl:value-of select="@type" /><xsl:if test="position() != last()">, </xsl:if>
                    </xsl:for-each>
                </p>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="missing">
        <div class="unavailable">
            <p><strong>Warning:</strong> PHPLoc enrichment not enabled or phploc.xml not found.</p>
        </div>
    </xsl:template>

    <xsl:template name="phploc">
        <xsl:variable name="phploc" select="//pdx:enrichment[@type='phploc']" />

        <div class="column">
            <div class="container">
                <h2>Structure</h2>
                <table class="styled overview">
                    <tr>
                        <td>Namespaces</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:namespaces" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td>Interfaces</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:interfaces" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td>Traits</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:traits" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td>Classes</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:classes" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td class="indent">Abstract Classes</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:abstractClasses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:abstractClasses div $phploc/pdx:classes * 100, '0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Concrete Classes</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:concreteClasses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:concreteClasses div $phploc/pdx:classes * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Methods</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:methods" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td class="indent">Scope</td>
                        <td />
                        <td />
                    </tr>
                    <tr>
                        <td class="indent2">Non-Static Methods</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:nonStaticMethods" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:nonStaticMethods div $phploc/pdx:methods * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent2">Static Methods</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:staticMethods" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:staticMethods div $phploc/pdx:methods * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Visibility</td>
                        <td />
                        <td />
                    </tr>
                    <tr>
                        <td class="indent2">Public Method</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:publicMethods" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:publicMethods div $phploc/pdx:methods * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent2">Non-Public Methods</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:nonPublicMethods" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:nonPublicMethods div $phploc/pdx:methods * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Functions</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:functions" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td class="indent">Named Functions</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:namedFunctions" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:namedFunctions div $phploc/pdx:functions * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Anonymous Functions</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:anonymousFunctions" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:anonymousFunctions div $phploc/pdx:functions * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Constants</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:constants" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td class="indent">Global Constants</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:globalConstants" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:globalConstants div $phploc/pdx:constants * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Class Constants</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:classConstants" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:classConstants div $phploc/pdx:constants * 100,'0.##')" />%)</td>
                    </tr>
                </table>
            </div>
            <div class="container">
                <h2>Tests</h2>
                <table class="styled overview">
                    <tr>
                        <td>Classes</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:testClasses" /></td>
                        <td class="percent"/>
                    </tr>
                    <tr>
                        <td>Methods</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:testMethods" /></td>
                        <td class="percent"/>
                    </tr>
                </table>
            </div>
        </div>
        <div class="column">
            <div class="container">
                <h2>Size</h2>
                <table class="styled overview">
                    <tr>
                        <td>Lines of Code (LOC)</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:loc" /></td>
                        <td/>
                    </tr>
                    <tr>
                        <td>Comment Lines of Code (CLOC)</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:cloc" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:cloc div $phploc/pdx:loc * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Non-Comment Lines of Code (NCLOC)</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:ncloc" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:ncloc div $phploc/pdx:loc * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Logical Lines of Code (LLOC)</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:lloc" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:lloc div $phploc/pdx:loc * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Classes</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:llocClasses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:llocClasses div $phploc/pdx:lloc * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Average Class Length</td>
                        <td class="nummeric"><xsl:value-of select="round($phploc/pdx:classLlocAvg)" /></td>
                        <td/>
                    </tr>
                    <tr>
                        <td class="indent">Average Method Length</td>
                        <td class="nummeric"><xsl:value-of select="round($phploc/pdx:methodLlocAvg)" /></td>
                        <td/>
                    </tr>
                    <tr>
                        <td>Functions</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:llocFunctions" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:llocFunctions div $phploc/pdx:lloc * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Average Function Length</td>
                        <td class="nummeric"><xsl:value-of select="round($phploc/pdx:llocByNof)" /></td>
                        <td/>
                    </tr>
                    <tr>
                        <td>Not in classes or functions</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:llocGlobal" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:llocGlobal div $phploc/pdx:lloc * 100,'0.##')" />%)</td>
                    </tr>
                </table>
            </div>

            <div class="container">
                <h2>Complexity</h2>
                <table class="styled overview">
                    <tr>
                        <td>Cyclomatic Complexity / LLOC</td>
                        <td class="nummeric"><xsl:value-of select="pdxf:format-number($phploc/pdx:ccnByLloc, '0.##')" /></td>
                        <td class="percent"/>
                    </tr>
                    <tr>
                        <td>Cyclomatic Complexity / Number of Methods</td>
                        <td class="nummeric"><xsl:value-of select="pdxf:format-number($phploc/pdx:ccnByNom, '0.##')" /></td>
                        <td class="percent"/>
                    </tr>
                </table>
            </div>

            <div class="container">
                <h2>Dependencies</h2>
                <table class="styled overview">
                    <tr>
                        <td>Global Accesses</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:globalAccesses" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td class="indent">Global Constants</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:globalConstantAccesses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:globalConstantAccesses div $phploc/pdx:globalAccesses * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Global Variables</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:globalVariableAccesses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:globalVariableAccesses div $phploc/pdx:globalAccesses * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Super-Global Variables</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:superGlobalVariableAccesses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:superGlobalVariableAccesses div $phploc/pdx:globalAccesses * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Attribute Accesses</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:attributeAccesses" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td class="indent">Non-Static</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:instanceAttributeAccesses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:instanceAttributeAccesses div $phploc/pdx:attributeAccesses * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Static</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:staticAttributeAccesses" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:staticAttributeAccesses div $phploc/pdx:attributeAccesses * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td>Method Calls</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:methodCalls" /></td>
                        <td />
                    </tr>
                    <tr>
                        <td class="indent">Non-Static</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:instanceMethodCalls" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:instanceMethodCalls div $phploc/pdx:methodCalls * 100,'0.##')" />%)</td>
                    </tr>
                    <tr>
                        <td class="indent">Static</td>
                        <td class="nummeric"><xsl:value-of select="$phploc/pdx:staticMethodCalls" /></td>
                        <td class="percent">(<xsl:value-of select="pdxf:format-number($phploc/pdx:staticMethodCalls div $phploc/pdx:methodCalls * 100,'0.##')" />%)</td>
                    </tr>
                </table>
            </div>

        </div>
    </xsl:template>

</xsl:stylesheet>