1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the `tvi/monitor-bundle` project. |
5
|
|
|
* |
6
|
|
|
* (c) https://github.com/turnaev/monitor-bundle/graphs/contributors |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE.md |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
|
|
|
|
11
|
|
|
|
12
|
|
|
namespace Tvi\MonitorBundle\Check; |
13
|
|
|
|
14
|
|
|
/** |
|
|
|
|
15
|
|
|
* @author Vladimir Turnaev <[email protected]> |
16
|
|
|
*/ |
|
|
|
|
17
|
|
|
trait CheckTrait |
18
|
|
|
{ |
19
|
|
|
/** |
|
|
|
|
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $id; |
23
|
|
|
|
24
|
|
|
/** |
|
|
|
|
25
|
|
|
* @var string[] |
26
|
|
|
*/ |
27
|
|
|
protected $tags = []; |
28
|
|
|
|
29
|
|
|
/** |
|
|
|
|
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
protected $group; |
33
|
|
|
|
34
|
|
|
/** |
|
|
|
|
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $descr; |
38
|
|
|
|
39
|
|
|
/** |
|
|
|
|
40
|
|
|
* @var ?string |
41
|
|
|
*/ |
42
|
|
|
protected $label; |
43
|
|
|
|
44
|
17 |
|
public function getId(): string |
|
|
|
|
45
|
|
|
{ |
46
|
17 |
|
return $this->id; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
|
|
|
|
50
|
|
|
* @return $this |
51
|
|
|
*/ |
52
|
54 |
|
public function setId(string $id) |
53
|
|
|
{ |
54
|
54 |
|
$this->id = $id; |
55
|
|
|
|
56
|
54 |
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
|
|
|
|
60
|
|
|
* @return string[] |
61
|
|
|
*/ |
62
|
3 |
|
public function getTags(): array |
63
|
|
|
{ |
64
|
3 |
|
return $this->tags; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
|
|
|
|
68
|
|
|
* @param string[] $tags |
|
|
|
|
69
|
|
|
* |
70
|
|
|
* @return $this |
71
|
|
|
*/ |
72
|
39 |
|
public function setTags(array $tags) |
73
|
|
|
{ |
74
|
39 |
|
$this->tags = $tags; |
75
|
|
|
|
76
|
39 |
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
3 |
|
public function getGroup(): string |
|
|
|
|
80
|
|
|
{ |
81
|
3 |
|
return $this->group; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
|
|
|
|
85
|
|
|
* @return $this |
86
|
|
|
*/ |
87
|
39 |
|
public function setGroup(string $group) |
88
|
|
|
{ |
89
|
39 |
|
$this->group = $group; |
90
|
|
|
|
91
|
39 |
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
|
95
|
2 |
|
public function getLabel() |
|
|
|
|
96
|
|
|
{ |
97
|
2 |
|
return $this->label; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
|
|
|
|
101
|
|
|
* @return $this |
102
|
|
|
*/ |
103
|
39 |
|
public function setLabel($label) |
104
|
|
|
{ |
105
|
39 |
|
$this->label = $label; |
106
|
|
|
|
107
|
39 |
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
|
|
|
|
111
|
|
|
* @return ?string |
112
|
|
|
*/ |
113
|
|
|
public function getDescr(): ?string |
114
|
|
|
{ |
115
|
|
|
return $this->descr; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
|
|
|
|
119
|
|
|
* @return $this |
120
|
|
|
*/ |
121
|
34 |
|
public function setDescr(?string $descr) |
122
|
|
|
{ |
123
|
34 |
|
$this->descr = $descr; |
124
|
|
|
|
125
|
34 |
|
return $this; |
126
|
|
|
} |
127
|
|
|
|
128
|
35 |
|
public function setAdditionParams(array $data) |
|
|
|
|
129
|
|
|
{ |
130
|
35 |
|
if (array_key_exists('id', $data)) { |
131
|
35 |
|
$this->setId($data['id']); |
132
|
|
|
} |
133
|
|
|
|
134
|
35 |
|
if (array_key_exists('group', $data)) { |
135
|
35 |
|
$this->setGroup($data['group']); |
136
|
|
|
} |
137
|
|
|
|
138
|
35 |
|
if (array_key_exists('tags', $data)) { |
139
|
35 |
|
$this->setTags($data['tags']); |
140
|
|
|
} |
141
|
|
|
|
142
|
35 |
|
if (array_key_exists('label', $data)) { |
143
|
35 |
|
$this->setLabel($data['label']); |
144
|
|
|
} |
145
|
|
|
|
146
|
35 |
|
if (array_key_exists('descr', $data)) { |
147
|
34 |
|
$this->setDescr($data['descr']); |
148
|
|
|
} |
149
|
35 |
|
} |
150
|
|
|
} |
151
|
|
|
|