|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* (c) Jean-François Lépine <https://twitter.com/Halleck45> |
|
5
|
|
|
* |
|
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
7
|
|
|
* file that was distributed with this source code. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Hal\Application\Config; |
|
11
|
|
|
use Hal\Application\Rule\RuleSet; |
|
12
|
|
|
use Hal\Component\Config\ConfigurationInterface; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Represents the configuration for analysis |
|
16
|
|
|
* |
|
17
|
|
|
* @author Jean-François Lépine <https://twitter.com/Halleck45> |
|
18
|
|
|
*/ |
|
19
|
|
|
class Configuration implements ConfigurationInterface |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* RuleSet |
|
23
|
|
|
* |
|
24
|
|
|
* @var RuleSet |
|
25
|
|
|
*/ |
|
26
|
|
|
private $ruleset; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var PathConfiguration |
|
30
|
|
|
*/ |
|
31
|
|
|
private $path; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Condition of failure |
|
35
|
|
|
* |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
private $failureCondition; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Targets of logging |
|
42
|
|
|
* |
|
43
|
|
|
* @var LoggingConfiguration |
|
44
|
|
|
*/ |
|
45
|
|
|
private $logging = array(); |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var TemplateConfiguration |
|
49
|
|
|
*/ |
|
50
|
|
|
private $template; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @var bool |
|
54
|
|
|
*/ |
|
55
|
|
|
private $ignoreErrors = false; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Constructor |
|
59
|
|
|
*/ |
|
60
|
|
|
public function __construct() { |
|
61
|
|
|
$this->ruleset = new RuleSet(); |
|
62
|
|
|
$this->failureCondition = null; |
|
63
|
|
|
$this->path = new PathConfiguration(); |
|
64
|
|
|
$this->logging = new LoggingConfiguration(); |
|
65
|
|
|
$this->template = new TemplateConfiguration(); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @param \Hal\Application\Rule\RuleSet $ruleset |
|
70
|
|
|
* @return self |
|
71
|
|
|
*/ |
|
72
|
|
|
public function setRuleSet(RuleSet $ruleset) |
|
73
|
|
|
{ |
|
74
|
|
|
$this->ruleset = $ruleset; |
|
75
|
|
|
return $this; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return \Hal\Application\Rule\RuleSet |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getRuleSet() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->ruleset; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @param string $failureCondition |
|
88
|
|
|
* @return self |
|
89
|
|
|
*/ |
|
90
|
|
|
public function setFailureCondition($failureCondition) |
|
91
|
|
|
{ |
|
92
|
|
|
$this->failureCondition = $failureCondition; |
|
93
|
|
|
return $this; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getFailureCondition() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->failureCondition; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @param LoggingConfiguration $logging |
|
106
|
|
|
* @return self |
|
107
|
|
|
*/ |
|
108
|
|
|
public function setLogging(LoggingConfiguration $logging) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->logging = $logging; |
|
111
|
|
|
return $this; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @return LoggingConfiguration |
|
116
|
|
|
*/ |
|
117
|
|
|
public function getLogging() |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->logging; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @param PathConfiguration $path |
|
124
|
|
|
* @return self |
|
125
|
|
|
*/ |
|
126
|
|
|
public function setPath($path) |
|
127
|
|
|
{ |
|
128
|
|
|
$this->path = $path; |
|
129
|
|
|
return $this; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return PathConfiguration |
|
134
|
|
|
*/ |
|
135
|
|
|
public function getPath() |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->path; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @param TemplateConfiguration $template |
|
142
|
|
|
* @return self |
|
143
|
|
|
*/ |
|
144
|
|
|
public function setTemplate($template) |
|
145
|
|
|
{ |
|
146
|
|
|
$this->template = $template; |
|
147
|
|
|
return $this; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* @return TemplateConfiguration |
|
152
|
|
|
*/ |
|
153
|
|
|
public function getTemplate() |
|
154
|
|
|
{ |
|
155
|
|
|
return $this->template; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @return boolean |
|
160
|
|
|
*/ |
|
161
|
|
|
public function getIgnoreErrors() |
|
162
|
|
|
{ |
|
163
|
|
|
return $this->ignoreErrors; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* @param boolean $ignoreErrors |
|
168
|
|
|
* @return $this |
|
169
|
|
|
*/ |
|
170
|
|
|
public function setIgnoreErrors($ignoreErrors) |
|
171
|
|
|
{ |
|
172
|
|
|
$this->ignoreErrors = $ignoreErrors; |
|
173
|
|
|
return $this; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
|
|
177
|
|
|
} |