1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the hogosha-monitor package |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2016 Guillaume Cavana |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* Feel free to edit as you please, and have fun. |
12
|
|
|
* |
13
|
|
|
* @author Guillaume Cavana <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Hogosha\Monitor\Model; |
17
|
|
|
|
18
|
|
|
use Hogosha\Monitor\Validator\Validator; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Guillaume Cavana <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
class UrlInfo |
24
|
|
|
{ |
25
|
|
|
protected $name; |
26
|
|
|
protected $url; |
27
|
|
|
protected $method; |
28
|
|
|
protected $headers; |
29
|
|
|
protected $timeout; |
30
|
|
|
protected $expectedStatus; |
31
|
|
|
protected $validator; |
32
|
|
|
protected $metricUuid; |
33
|
|
|
protected $serviceUuid; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Constructor. |
37
|
|
|
* |
38
|
|
|
* @param string $name |
39
|
|
|
* @param string $url |
40
|
|
|
* @param string $method |
41
|
|
|
* @param array $headers |
42
|
|
|
* @param int $timeout |
43
|
|
|
* @param int $expectedStatus |
44
|
|
|
* @param Validator $validator |
45
|
|
|
* @param string $metricUuid |
46
|
|
|
* @param string $serviceUuid |
47
|
|
|
*/ |
48
|
|
|
public function __construct( |
49
|
|
|
$name, |
50
|
|
|
$url, |
51
|
|
|
$method, |
52
|
|
|
array $headers, |
53
|
|
|
$timeout, |
54
|
|
|
$expectedStatus, |
55
|
|
|
Validator $validator, |
56
|
|
|
$metricUuid, |
57
|
|
|
$serviceUuid |
58
|
|
|
) { |
59
|
|
|
$this->name = $name; |
60
|
|
|
$this->url = $url; |
61
|
|
|
$this->method = $method; |
62
|
|
|
$this->headers = $headers; |
63
|
|
|
$this->timeout = $timeout; |
64
|
|
|
$this->expectedStatus = $expectedStatus; |
65
|
|
|
$this->metricUuid = $metricUuid; |
66
|
|
|
$this->serviceUuid = $serviceUuid; |
67
|
|
|
$this->validator = $validator; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* getName. |
72
|
|
|
* |
73
|
|
|
* @return string |
74
|
|
|
*/ |
75
|
|
|
public function getName() |
76
|
|
|
{ |
77
|
|
|
return $this->name; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* getUrl. |
82
|
|
|
* |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
|
|
public function getUrl() |
86
|
|
|
{ |
87
|
|
|
return $this->url; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* getMethod. |
92
|
|
|
* |
93
|
|
|
* @return string |
94
|
|
|
*/ |
95
|
|
|
public function getMethod() |
96
|
|
|
{ |
97
|
|
|
return $this->method; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* getHeaders. |
102
|
|
|
* |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function getHeaders() |
106
|
|
|
{ |
107
|
|
|
return $this->headers; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* getTimeOut. |
112
|
|
|
* |
113
|
|
|
* @return int |
114
|
|
|
*/ |
115
|
|
|
public function getTimeOut() |
116
|
|
|
{ |
117
|
|
|
return $this->timeout; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* getTimeOut. |
122
|
|
|
* |
123
|
|
|
* @return int |
124
|
|
|
*/ |
125
|
|
|
public function getExpectedStatus() |
126
|
|
|
{ |
127
|
|
|
return $this->expectedStatus; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* getMetricUuid. |
132
|
|
|
* |
133
|
|
|
* @return string |
134
|
|
|
*/ |
135
|
|
|
public function getMetricUuid() |
136
|
|
|
{ |
137
|
|
|
return $this->metricUuid; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* getServiceUuid. |
142
|
|
|
* |
143
|
|
|
* @return string |
144
|
|
|
*/ |
145
|
|
|
public function getServiceUuid() |
146
|
|
|
{ |
147
|
|
|
return $this->serviceUuid; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* getValidator. |
152
|
|
|
* |
153
|
|
|
* @return Validator |
154
|
|
|
*/ |
155
|
|
|
public function getValidator() |
156
|
|
|
{ |
157
|
|
|
return $this->validator; |
158
|
|
|
} |
159
|
|
|
} |
160
|
|
|
|