Repository navigation
Expand file tree
/
Copy pathdebug_test.php
More file actions
149 lines (121 loc) · 3.32 KB
/
Copy pathdebug_test.php
File metadata and controls
149 lines (121 loc) · 3.32 KB
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
<?php
class TestClass {
// First method - should be normal
public function method1() {
echo "This is method1";
return true;
}
// Second method - should be normal
private function method2() {
echo "This is method2";
return false;
}
// Duplicate of method1 - should be marked
public function method1() {
echo "This is duplicate method1";
return "duplicate";
}
// Third method - should be normal
protected function method3($param1, $param2) {
return $param1 + $param2;
}
// Duplicate of method2 - should be marked
private function method2() {
echo "This is another duplicate method2";
return null;
}
}
// Functions outside class - module level
function global_function1() {
echo "Global function 1";
}
function global_function2() {
echo "Global function 2";
}
// Duplicate global function - should be marked
function global_function1() {
echo "Duplicate global function 1";
}
class AnotherClass {
// Static method - should be normal
public static function staticMethod() {
return "static";
}
// Another method - should be normal
public function anotherMethod() {
return "another";
}
// Duplicate static method - should be marked
public static function staticMethod() {
return "duplicate static";
}
}
// Test different PHP method variations
class VariationsClass {
// Method with type hints
public function typedMethod(string $param): int {
return strlen($param);
}
// Method with default parameters
public function defaultMethod($param = "default") {
return $param;
}
// Duplicate of typedMethod - should be marked
public function typedMethod(string $param): int {
return strlen($param) * 2;
}
// Method with visibility modifiers
private function privateMethod() {
return "private";
}
// Another private method - should be normal
private function anotherPrivateMethod() {
return "another private";
}
// Duplicate of privateMethod - should be marked
private function privateMethod() {
return "duplicate private";
}
}
// Test function with different parameter patterns
function function_with_underscores() {
echo "Function with underscores";
}
function function_with_underscores() {
echo "Duplicate function with underscores";
}
// Test camelCase functions
function camelCaseFunction() {
echo "Camel case function";
}
function camelCaseFunction() {
echo "Duplicate camel case function";
}
// Test with different visibility in same class
class VisibilityTest {
public function sameNameMethod() {
return "public";
}
// This should be marked as duplicate even with different visibility
private function sameNameMethod() {
return "private";
}
// This should also be marked
protected function sameNameMethod() {
return "protected";
}
}
class VisibilityTest {
public function sameNameMethod() {
return "public";
}
// This should be marked as duplicate even with different visibility
private function sameNameMethod() {
return "private";
}
// This should also be marked
protected function sameNameMethod() {
return "protected";
}
}
?>