We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef04b8d commit bb74a56Copy full SHA for bb74a56
bad.php
@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+class BadDesign
4
+{
5
+ // No class doc comment — cleancode
6
7
+ public function messyFunction($a, $b)
8
+ {
9
+ // No function doc comment — cleancode
10
11
+ $unused = 123; // unused variable — cleancode
12
13
+ // Long method with nested loops — codesize + design
14
+ $sum = 0;
15
+ for ($i = 0; $i < 10; $i++) {
16
+ for ($j = 0; $j < 10; $j++) {
17
+ $sum += $i * $j;
18
+ }
19
20
21
+ // Excessive method complexity — design
22
+ if ($a > 10) {
23
+ if ($b < 5) {
24
+ for ($k = 0; $k < 5; $k++) {
25
+ $sum += $k;
26
27
+ } else {
28
+ while ($b > 0) {
29
+ $sum -= $b;
30
+ $b--;
31
32
33
34
35
+ return $sum;
36
37
+}
38
39
+$obj = new BadDesign();
40
+echo $obj->messyFunction(15, 3);
0 commit comments