Failed Conditions
Push — master ( c7ef78...c451af )
by Alexander
02:24
created

Magic_Test::__clone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 1
rs 10
1
<?php
2
3
abstract class My_Class {
4
5
    public function __construct() {}
6
    public function My_Class() {}
7
    public function _My_Class() {}
8
9
    public function getSomeValue() {}
10
    public function parseMyDSN() {}
11
    public function get_some_value() {}
12
    public function GetSomeValue() {}
13
    public function getSomeValue_Again() {}
14
    public function My_Package_getSomeValue() {}
15
    public function _getSomeValue() {}
16
    public function _parseMyDSN() {}
17
    public function _get_some_value() {}
18
    public function _GetSomeValue() {}
19
    public function _getSomeValue_Again() {}
20
    public function _My_Package_getSomeValue() {}
21
22
    protected function getSomeValue() {}
23
    protected function parseMyDSN() {}
24
    protected function get_some_value() {}
25
    protected function GetSomeValue() {}
26
    protected function getSomeValue_Again() {}
27
    protected function My_Package_getSomeValue() {}
28
    protected function _getSomeValue() {}
29
    protected function _parseMyDSN() {}
30
    protected function _get_some_value() {}
31
    protected function _GetSomeValue() {}
32
    protected function _getSomeValue_Again() {}
33
    protected function _My_Package_getSomeValue() {}
34
35
    private function getSomeValue() {}
36
    private function parseMyDSN() {}
37
    private function get_some_value() {}
38
    private function GetSomeValue() {}
39
    private function getSomeValue_Again() {}
40
    private function My_Package_getSomeValue() {}
41
    private function _getSomeValue() {}
42
    private function _parseMyDSN() {}
43
    private function _get_some_value() {}
44
    private function _GetSomeValue() {}
45
    private function _getSomeValue_Again() {}
46
    private function _My_Package_getSomeValue() {}
47
48
    function getSomeValue() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
49
    function parseMyDSN() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
50
    function get_some_value() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
51
    function GetSomeValue() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
52
    function getSomeValue_Again() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
53
    function My_Package_getSomeValue() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
54
    function _getSomeValue() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
55
    function _parseMyDSN() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
56
    function _get_some_value() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
57
    function _GetSomeValue() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
58
    function _getSomeValue_Again() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
59
    function _My_Package_getSomeValue() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
60
61
}//end class
62
63
interface My_Interface {
64
65
    public function getSomeValue() {}
66
    public function parseMyDSN() {}
67
    public function get_some_value() {}
68
    public function GetSomeValue() {}
69
    public function getSomeValue_Again() {}
70
    public function My_Package_getSomeValue() {}
71
    public function _getSomeValue() {}
72
    public function _parseMyDSN() {}
73
    public function _get_some_value() {}
74
    public function _GetSomeValue() {}
75
    public function _getSomeValue_Again() {}
76
    public function _My_Package_getSomeValue() {}
77
78
    protected function getSomeValue() {}
79
    protected function parseMyDSN() {}
80
    protected function get_some_value() {}
81
    protected function GetSomeValue() {}
82
    protected function getSomeValue_Again() {}
83
    protected function My_Package_getSomeValue() {}
84
    protected function _getSomeValue() {}
85
    protected function _parseMyDSN() {}
86
    protected function _get_some_value() {}
87
    protected function _GetSomeValue() {}
88
    protected function _getSomeValue_Again() {}
89
    protected function _My_Package_getSomeValue() {}
90
91
    private function getSomeValue() {}
92
    private function parseMyDSN() {}
93
    private function get_some_value() {}
94
    private function GetSomeValue() {}
95
    private function getSomeValue_Again() {}
96
    private function My_Package_getSomeValue() {}
97
    private function _getSomeValue() {}
98
    private function _parseMyDSN() {}
99
    private function _get_some_value() {}
100
    private function _GetSomeValue() {}
101
    private function _getSomeValue_Again() {}
102
    private function _My_Package_getSomeValue() {}
103
104
    function getSomeValue() {}
105
    function parseMyDSN() {}
106
    function get_some_value() {}
107
    function GetSomeValue() {}
108
    function getSomeValue_Again() {}
109
    function My_Package_getSomeValue() {}
110
    function _getSomeValue() {}
111
    function _parseMyDSN() {}
112
    function _get_some_value() {}
113
    function _GetSomeValue() {}
114
    function _getSomeValue_Again() {}
115
    function _My_Package_getSomeValue() {}
116
117
}//end interface
118
119
function My_Package_getSomeValue() {}
120
function My_Package_parseMyDSN() {}
121
function My_Package_get_some_value() {}
122
function My_PackagegetSomeValue() {}
123
function My_Package_getSomeValue_Again() {}
124
function My_Package() {}
125
function _My_Package_getSomeValue() {}
126
function _My_Package_parseMyDSN() {}
127
function _My_Package_get_some_value() {}
128
function _My_PackagegetSomeValue() {}
129
function _My_Package_getSomeValue_Again() {}
130
function _My_Package() {}
131
132
133
/* Test for magic functions */
134
135
class Magic_Test {
136
    function __construct() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
137
    function __destruct() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
138
    function __call() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
139
    function __callStatic() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
140
    function __get() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
141
    function __set() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
142
    function __isset() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
143
    function __unset() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
144
    function __sleep() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
145
    function __wakeup() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
146
    function __toString() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
147
    function __set_state() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
148
    function __clone() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
149
    function __autoload() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
150
    function __invoke() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
151
    function __myFunction() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
152
    function __my_function() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
153
}
154
155
function __construct() {}
156
function __destruct() {}
157
function __call() {}
158
function __callStatic() {}
159
function __get() {}
160
function __set() {}
161
function __isset() {}
162
function __unset() {}
163
function __sleep() {}
164
function __wakeup() {}
165
function __toString() {}
166
function __set_state() {}
167
function __clone() {}
168
function __autoload() {}
169
function __invoke() {}
170
function __myFunction() {}
171
function __my_function() {}
172
173
function my_package_function() {}
174
function Package_() {}
175
function Package() {}
176
177
class Closure_Test {
178
    function test() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
179
        $foo = function() { echo 'foo'; };
0 ignored issues
show
Unused Code introduced by
$foo is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
180
    }
181
}
182
183
function test() {
0 ignored issues
show
Best Practice introduced by
The function test() has been defined more than once; this definition is ignored, only the first definition in CodingStandard/Tests/Com...lineCommentUnitTest.inc (L12-20) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
184
    $foo = function() { echo 'foo'; };
0 ignored issues
show
Unused Code introduced by
$foo is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
185
}
186
187
/* @codingStandardsIgnoreStart */
188
class MyClass
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type MyClass has been defined more than once; this definition is ignored, only the first definition in CodingStandard/Tests/Com...lineCommentUnitTest.inc (L70-79) is considered.

This check looks for classes that have been defined more than once.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
189
{
190
    /* @codingStandardsIgnoreEnd */
191
    public function __construct() {}
192
}
193
194
trait Foo
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Foo has been defined more than once; this definition is ignored, only the first definition in CodingStandard/Tests/Cla...ssNamespaceUnitTest.inc (L2-4) is considered.

This check looks for classes that have been defined more than once.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
195
{
196
    function __call() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
197
}
198
199
class Magic_Case_Test {
200
    function __Construct() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
201
    function __isSet() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
202
    function __tostring() {}
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
203
}
204
function __autoLoad() {}
0 ignored issues
show
Best Practice introduced by
The function __autoLoad() has been defined more than once; this definition is ignored, only the first definition in this file (L168-168) is considered.

This check looks for functions that have already been defined in the same file.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
205
206
class SomeEventHandler extends kDBEventHandler
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type SomeEventHandler has been defined more than once; this definition is ignored, only the first definition in CodingStandard/Tests/Com...onCommentUnitTest.2.inc (L3-35) is considered.

This check looks for classes that have been defined more than once.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
207
{
208
209
    protected function OnSomeEvent(kEvent $event)
210
    {
211
    }
212
213
    protected function SetCustomQuery()
214
    {
215
    }
216
217
    protected function CheckPermission()
218
    {
219
    }
220
221
    protected function ListPrepareQuery()
222
    {
223
    }
224
225
    protected function ItemPrepareQuery()
226
    {
227
    }
228
229
    protected function SetPagination()
230
    {
231
    }
232
233
    protected function SetSorting()
234
    {
235
    }
236
237
}
238
239
class SomeTagProcessor extends kDBTagProcessor
240
{
241
242
    function PrepareListElementParams()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
243
    {
244
    }
245
}
246
247
class SomeEventHandlerFeature extends kDBEventHandler
248
{
249
250
    protected function OnSomeEvent(kEvent $event)
251
    {
252
    }
253
254
    protected function SetCustomQuery()
255
    {
256
    }
257
258
    protected function CheckPermission()
259
    {
260
    }
261
262
    protected function ListPrepareQuery()
263
    {
264
    }
265
266
    protected function ItemPrepareQuery()
267
    {
268
    }
269
270
    protected function SetPagination()
271
    {
272
    }
273
274
    protected function SetSorting()
275
    {
276
    }
277
278
}
279
280
class SomeTagProcessorFeature extends kDBTagProcessor
281
{
282
283
    function PrepareListElementParams()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
284
    {
285
    }
286
}
287
288
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
289