1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace whm\Smoke\Rules; |
4
|
|
|
|
5
|
|
|
use phm\HttpWebdriverClient\Http\Response\UriAwareResponse; |
6
|
|
|
use Psr\Http\Message\ResponseInterface; |
7
|
|
|
|
8
|
|
|
class CheckResult |
9
|
|
|
{ |
10
|
|
|
const STATUS_SUCCESS = 'success'; |
11
|
|
|
const STATUS_FAILURE = 'failure'; |
12
|
|
|
const STATUS_NONE = 'none'; |
13
|
|
|
|
14
|
|
|
private $status; |
15
|
|
|
private $value; |
16
|
|
|
private $message; |
17
|
|
|
private $attributes = array(); |
18
|
|
|
private $ruleName; |
19
|
|
|
private $url; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var ResponseInterface |
23
|
|
|
*/ |
24
|
|
|
private $response; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Result constructor. |
28
|
|
|
* |
29
|
|
|
* @param $status |
30
|
|
|
* @param $value |
31
|
|
|
* @param $message |
32
|
|
|
*/ |
33
|
|
|
public function __construct($status, $message = '', $value = null, $url = null) |
34
|
|
|
{ |
35
|
|
|
$this->status = $status; |
36
|
|
|
$this->value = $value; |
37
|
|
|
$this->message = $message; |
38
|
|
|
$this->url = $url; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return Attribute[] |
43
|
|
|
*/ |
44
|
|
|
public function getAttributes() |
45
|
|
|
{ |
46
|
|
|
return $this->attributes; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param array $attributes |
|
|
|
|
51
|
|
|
*/ |
52
|
|
|
public function addAttribute(Attribute $attribute) |
53
|
|
|
{ |
54
|
|
|
$this->attributes[] = $attribute; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return mixed |
59
|
|
|
*/ |
60
|
|
|
public function getStatus() |
61
|
|
|
{ |
62
|
|
|
return $this->status; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return mixed |
67
|
|
|
*/ |
68
|
|
|
public function getValue() |
69
|
|
|
{ |
70
|
|
|
return $this->value; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
public function getMessage() |
77
|
|
|
{ |
78
|
|
|
return $this->message; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param string $message |
83
|
|
|
*/ |
84
|
|
|
public function setMessage($message) |
85
|
|
|
{ |
86
|
|
|
$this->message = $message; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return UriAwareResponse |
91
|
|
|
*/ |
92
|
|
|
public function getResponse() |
93
|
|
|
{ |
94
|
|
|
return $this->response; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param ResponseInterface $response |
99
|
|
|
*/ |
100
|
|
|
public function setResponse(ResponseInterface $response) |
101
|
|
|
{ |
102
|
|
|
$this->response = $response; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return mixed |
107
|
|
|
*/ |
108
|
|
|
public function getRuleName() |
109
|
|
|
{ |
110
|
|
|
return $this->ruleName; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param mixed $ruleName |
115
|
|
|
*/ |
116
|
|
|
public function setRuleName($ruleName) |
117
|
|
|
{ |
118
|
|
|
$this->ruleName = $ruleName; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return string |
123
|
|
|
*/ |
124
|
|
|
public function getUrl() |
125
|
|
|
{ |
126
|
|
|
return $this->url; |
127
|
|
|
} |
128
|
|
|
} |
129
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.