-
Notifications
You must be signed in to change notification settings - Fork 12
/
Fingerprint.php
45 lines (39 loc) · 1.02 KB
/
Fingerprint.php
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
<?php
namespace PHPMD;
class Fingerprint
{
const OVERRIDE_RULES = [
"Controversial/CamelCaseVariableName",
"Controversial/CamelCasePropertyName",
"CyclomaticComplexity",
"Design/CouplingBetweenObjects",
"Design/LongClass",
"Design/LongMethod",
"Design/LongParameterList",
"Design/NpathComplexity",
"Design/NumberOfChildren",
"Design/TooManyFields",
"Design/TooManyMethods",
"Design/TooManyPublicMethods",
"Design/WeightedMethodCount",
"ExcessivePublicCount",
"Naming/ShortMethodName",
];
private $name;
private $path;
private $rule;
public function __construct($path, $rule, $name)
{
$this->path = $path;
$this->rule = $rule;
$this->name = $name;
}
public function compute()
{
$fingerprint = null;
if (in_array($this->rule, self::OVERRIDE_RULES)) {
$fingerprint = md5($this->path . $this->rule . $this->name);
}
return $fingerprint;
}
}