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
|
|
|
/** |
19
|
|
|
* @author Guillaume Cavana <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class Result |
22
|
|
|
{ |
23
|
|
|
protected $urlInfo; |
24
|
|
|
protected $statusCode; |
25
|
|
|
protected $responseTime; |
26
|
|
|
protected $handlerError; |
27
|
|
|
protected $validatorResult; |
28
|
|
|
protected $validatorError; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Constructor. |
32
|
|
|
* |
33
|
|
|
* @param UrlInfo $urlInfo |
34
|
|
|
* @param string $statusCode |
35
|
|
|
* @param float $responseTime |
36
|
|
|
* @param string $handlerError Get a string error from the handler |
37
|
|
|
* @param bool|null $validatorResult Get the validator result |
38
|
|
|
* @param string $validatorError Get the validator error |
39
|
|
|
*/ |
40
|
|
|
public function __construct( |
41
|
|
|
UrlInfo $urlInfo, |
42
|
|
|
$statusCode, |
43
|
|
|
$responseTime, |
44
|
|
|
$handlerError = null, |
45
|
|
|
$validatorResult = null, |
46
|
|
|
$validatorError = null |
47
|
|
|
) { |
48
|
|
|
$this->urlInfo = $urlInfo; |
49
|
|
|
$this->statusCode = $statusCode; |
50
|
|
|
$this->responseTime = $responseTime; |
51
|
|
|
$this->handlerError = $handlerError; |
52
|
|
|
$this->validatorResult = $validatorResult; |
53
|
|
|
$this->validatorError = $validatorError; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* getUrl. |
58
|
|
|
* |
59
|
|
|
* @return UrlInfo |
60
|
|
|
*/ |
61
|
|
|
public function getUrl() |
62
|
|
|
{ |
63
|
|
|
return $this->urlInfo; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* getStatusCode. |
68
|
|
|
* |
69
|
|
|
* @return int |
70
|
|
|
*/ |
71
|
|
|
public function getStatusCode() |
72
|
|
|
{ |
73
|
|
|
return $this->statusCode; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* getReponseTime. |
78
|
|
|
* |
79
|
|
|
* @return float |
80
|
|
|
*/ |
81
|
|
|
public function getReponseTime() |
82
|
|
|
{ |
83
|
|
|
return $this->responseTime; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* getHandlerError. |
88
|
|
|
* |
89
|
|
|
* @return string|null |
90
|
|
|
*/ |
91
|
|
|
public function getHandlerError() |
92
|
|
|
{ |
93
|
|
|
return $this->handlerError; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* getValidatorResult. |
98
|
|
|
* |
99
|
|
|
* @return bool |
100
|
|
|
*/ |
101
|
|
|
public function getValidatorResult() |
102
|
|
|
{ |
103
|
|
|
return $this->validatorResult; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* getValidatorError. |
108
|
|
|
* |
109
|
|
|
* @return string|null |
110
|
|
|
*/ |
111
|
|
|
public function getValidatorError() |
112
|
|
|
{ |
113
|
|
|
return $this->validatorError; |
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
|