Skip to content

Commit ef83e7a

Browse files
author
DKravtsov
committed
Added phpcpd report schema v1.0.0.
1 parent 6aa844f commit ef83e7a

File tree

9 files changed

+187
-6
lines changed

9 files changed

+187
-6
lines changed

images/favicon.ico

318 Bytes
Binary file not shown.

images/logo-black-big.png

7.82 KB
Loading

images/logo-black-small.png

2.68 KB
Loading

images/logo-white-big.png

8.27 KB
Loading

images/logo-white-small.png

2.83 KB
Loading

phpcpd/report/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>PHP Copy/Paste Detector</title>
5+
</head>
6+
<body>
7+
<div style="text-align: center;"><a href="https://www.systemsdk.com" target="_self"><img src="../../images/logo-black-big.png" alt="Visit web-site"></a></div>
8+
</body>
9+
</html>
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cpd="https://systemsdk.github.io/phpcpd/schema" exclude-result-prefixes="cpd">
2+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cpd="https://systemsdk.github.io/phpcpd/report" exclude-result-prefixes="cpd">
33
<xsl:output method="html" doctype-system="about:legacy-compat"/>
44
<xsl:template match="/">
55
<html>
@@ -18,11 +18,13 @@
1818
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"/>
1919
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"/>
2020
<script src="https://cdn.datatables.net/v/bs5/jszip-2.5.0/dt-1.13.4/b-2.3.6/b-html5-2.3.6/b-print-2.3.6/datatables.min.js"/>
21+
<title>PHPCPD Report</title>
22+
<link rel="icon" href="https://systemsdk.github.io/images/favicon.ico" sizes="32x32" />
2123

2224
</head>
2325
<body style="padding-top: 3.5rem;">
2426
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
25-
<a class="navbar-brand" href="#">PHP Copy/Paste Detector</a>
27+
<a class="navbar-brand" href="#"></a>
2628
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
2729
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
2830
<span class="navbar-toggler-icon"></span>
@@ -43,13 +45,14 @@
4345
</li>
4446
</ul>
4547
</div>
48+
<img alt="Logo" src="https://systemsdk.github.io/images/logo-white-small.png" style="border-right: 20px solid;"/>
4649
</nav>
4750

4851
<div class="container">
4952
<div class="row">
5053
<div class="col">
51-
<h4>Summary of duplicated code</h4>
52-
<p>This page summarizes the code fragments that have been found to be replicated in the code.</p>
54+
<h4>PHPCPD <font color="#0000FF"><xsl:value-of select="cpd:pmd-cpd/attribute::phpcpdVersion"/></font> - Summary of duplicated code</h4>
55+
<p>This page summarizes the code fragments that have been found at <font color="#0000FF"><xsl:value-of select="cpd:pmd-cpd/attribute::timestamp"/></font> to be replicated in the code.</p>
5356

5457
<table class="table table-light table-bordered table-striped table-hover">
5558
<tr>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<xs:schema
33
xmlns:xs="http://www.w3.org/2001/XMLSchema"
4-
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="https://systemsdk.github.io/phpcpd/schema"
5-
targetNamespace="https://systemsdk.github.io/phpcpd/schema"
4+
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="https://systemsdk.github.io/phpcpd/report"
5+
targetNamespace="https://systemsdk.github.io/phpcpd/report"
66
elementFormDefault="qualified">
77

88
<xsd:annotation>

phpcpd/report/report-example.html

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<!DOCTYPE HTML SYSTEM "about:legacy-compat">
2+
<html>
3+
<head>
4+
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<meta charset="utf-8">
6+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
7+
<script src="https://code.jquery.com/jquery-3.7.0.min.js" integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script>
8+
<link href="https://cdn.datatables.net/v/bs5/jszip-2.5.0/dt-1.13.4/b-2.3.6/b-html5-2.3.6/b-print-2.3.6/datatables.min.css" rel="stylesheet">
9+
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script><script src="https://cdn.datatables.net/v/bs5/jszip-2.5.0/dt-1.13.4/b-2.3.6/b-html5-2.3.6/b-print-2.3.6/datatables.min.js"></script>
10+
<title>PHPCPD Report</title>
11+
<link rel="icon" href="https://systemsdk.github.io/images/favicon.ico" sizes="32x32">
12+
</head>
13+
<body style="padding-top: 3.5rem;">
14+
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
15+
<a class="navbar-brand" href="#"></a><button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
16+
<div class="collapse navbar-collapse" id="navbarNav">
17+
<ul class="navbar-nav">
18+
<li class="nav-item">
19+
<a class="nav-link active" href="#">Report</a>
20+
</li>
21+
<li class="nav-item" id="nav_enable_datatable">
22+
<a class="nav-link" href="?d=">Enable datatable</a>
23+
</li>
24+
<li class="nav-item" id="nav_disable_datatable">
25+
<a class="nav-link" href="?">Disable datatable</a>
26+
</li>
27+
<li class="nav-item">
28+
<a class="nav-link" target="_blank" rel="noopener noreferrer" href="https://packagist.org/packages/systemsdk/phpcpd">Package page</a>
29+
</li>
30+
</ul>
31+
</div>
32+
<img alt="Logo" src="https://systemsdk.github.io/images/logo-white-small.png" style="border-right: 20px solid;"></nav>
33+
<div class="container">
34+
<div class="row">
35+
<div class="col">
36+
<h4>PHPCPD <font color="#0000FF">8.2.0</font> - Summary of duplicated code</h4>
37+
<p>This page summarizes the code fragments that have been found at <font color="#0000FF">2025-04-29T17:39:52+00:00</font> to be replicated in the code.</p>
38+
<table class="table table-light table-bordered table-striped table-hover">
39+
<tr>
40+
<th># Duplications</th><th>Total lines</th><th>Total tokens</th><th>Approximate number of bytes</th>
41+
</tr>
42+
<tr>
43+
<td class="SummaryNumber">1</td><td class="SummaryNumber">59</td><td class="SummaryNumber">136</td><td class="SummaryNumber">544</td>
44+
</tr>
45+
</table>
46+
</div>
47+
</div>
48+
<div class="row">
49+
<div class="col">
50+
<h4>Details of duplicated code</h4>
51+
</div>
52+
<table style="width:100%" id="data_table" class="table table-light table-bordered table-striped table-hover">
53+
<thead>
54+
<tr>
55+
<th>lines</th><th>tokens</th><th>files</th><th>codefragment</th>
56+
</tr>
57+
</thead>
58+
<tbody>
59+
<tr>
60+
<td>59</td><td>136</td><td>
61+
<table class="table table-light table-bordered table-striped table-hover">
62+
<tr>
63+
<th>line</th><th>endline</th><th>path</th>
64+
</tr>
65+
<tr>
66+
<td>116</td><td>175</td><td>/var/www/html/tests/Fixture/Math.php</td>
67+
</tr>
68+
<tr>
69+
<td>217</td><td>276</td><td>/var/www/html/tests/Fixture/Math.php</td>
70+
</tr>
71+
</table>
72+
</td><td>
73+
<pre> public function div($v1, $v2)
74+
{
75+
$v3 = $v1 / ($v2 + $v1);
76+
if ($v3 > 14)
77+
{
78+
$v4 = 0;
79+
for ($i = 0; $i < $v3; $i++)
80+
{
81+
$v4 += ($v2 * $i);
82+
}
83+
}
84+
$v5 = ($v4 < $v3 ? ($v3 - $v4) : ($v4 - $v3));
85+
86+
$v6 = ($v1 * $v2 * $v3 * $v4 * $v5);
87+
88+
$d = array($v1, $v2, $v3, $v4, $v5, $v6);
89+
90+
$v7 = 1;
91+
for ($i = 0; $i < $v6; $i++)
92+
{
93+
shuffle( $d );
94+
$v7 = $v7 + $i * end($d);
95+
}
96+
97+
$v8 = $v7;
98+
foreach ( $d as $x )
99+
{
100+
$v8 *= $x;
101+
}
102+
103+
$v3 = $v1 / ($v2 + $v1);
104+
if ($v3 > 14)
105+
{
106+
$v4 = 0;
107+
for ($i = 0; $i < $v3; $i++)
108+
{
109+
$v4 += ($v2 * $i);
110+
}
111+
}
112+
$v5 = ($v4 < $v3 ? ($v3 - $v4) : ($v4 - $v3));
113+
114+
$v6 = ($v1 * $v2 * $v3 * $v4 * $v5);
115+
116+
$d = array($v1, $v2, $v3, $v4, $v5, $v6);
117+
118+
$v7 = 1;
119+
for ($i = 0; $i < $v6; $i++)
120+
{
121+
shuffle( $d );
122+
$v7 = $v7 + $i * end($d);
123+
}
124+
125+
$v8 = $v7;
126+
foreach ( $d as $x )
127+
{
128+
$v8 *= $x;
129+
}
130+
131+
return $v8;
132+
</pre>
133+
</td>
134+
</tr>
135+
</tbody>
136+
</table>
137+
</div>
138+
</div>
139+
<script>
140+
let params = (new URL(document.location)).searchParams;
141+
let showDatatable = false;
142+
143+
//------------ can be called with this parameter d
144+
if (params.get('d') !== null) { // got it via query param d
145+
showDatatable = true;
146+
}
147+
148+
if (showDatatable) {
149+
$("#nav_disable_datatable").show();
150+
$("#nav_enable_datatable").hide();
151+
$(document).ready( function () {
152+
$('#data_table').DataTable({
153+
dom: "<'row'<'col-sm-12 col-md-4'B><'col-sm-12 col-md-4'l><'col-sm-12 col-md-4'f>>" +
154+
"<'row'<'col-sm-12'tr>>" +
155+
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
156+
buttons: [
157+
'copy', 'csv', 'excel', 'pdf', 'print'
158+
]
159+
}
160+
);
161+
} );
162+
} else {
163+
$("#nav_disable_datatable").hide();
164+
$("#nav_enable_datatable").show();
165+
}
166+
167+
</script>
168+
</body>
169+
</html>

0 commit comments

Comments
 (0)