1 | <?php |
||
35 | class Configuration |
||
36 | { |
||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | const CONF_MAX_FAILURES = 'max_failures'; |
||
41 | |||
42 | /** |
||
43 | * @var string |
||
44 | */ |
||
45 | const CONF_DISABLED = 'disabled'; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | const CONF_RESTRICTION_TIME = 'restriction_time'; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | const CONF_SECONDS_TILL_RESET = 'seconds_till_reset'; |
||
56 | |||
57 | /** |
||
58 | * @var string |
||
59 | */ |
||
60 | const LOGGING_ENABLED = 'logging_enabled'; |
||
61 | |||
62 | /** |
||
63 | * @var string |
||
64 | */ |
||
65 | const LOGGING_LEVEL = 'logging_level'; |
||
66 | |||
67 | /** |
||
68 | * @var string |
||
69 | */ |
||
70 | const EXCLUDED_IPS = 'exclude_ips'; |
||
71 | |||
72 | /** |
||
73 | * @var string |
||
74 | */ |
||
75 | const X_FORWARDED_FOR = 'x_forwarded_for'; |
||
76 | |||
77 | /** |
||
78 | * @var string |
||
79 | */ |
||
80 | const CONF_IDENTIFICATION_IDENTIFIER = 'identification_identifier'; |
||
81 | |||
82 | /** |
||
83 | * @var array |
||
84 | */ |
||
85 | private $configuration = array(); |
||
86 | |||
87 | /** |
||
88 | * Initialize configuration array |
||
89 | */ |
||
90 | 37 | public function __construct() |
|
97 | |||
98 | /** |
||
99 | * Tells if the protection is enabled. |
||
100 | * |
||
101 | * @return boolean |
||
102 | */ |
||
103 | 2 | public function isEnabled() |
|
110 | |||
111 | /** |
||
112 | * Returns the maximum number of allowed failures for an ip. |
||
113 | * |
||
114 | * @return integer |
||
115 | */ |
||
116 | 1 | public function getMaximumNumberOfFailures() |
|
120 | |||
121 | /** |
||
122 | * Returns the number of seconds of the restriction time. |
||
123 | * |
||
124 | * @return integer |
||
125 | */ |
||
126 | 1 | public function getRestrictionTime() |
|
130 | |||
131 | /** |
||
132 | * Returns the number of seconds after an entry is resetted. |
||
133 | * |
||
134 | * @return integer |
||
135 | */ |
||
136 | 1 | public function getResetTime() |
|
140 | |||
141 | /** |
||
142 | * @return boolean |
||
143 | */ |
||
144 | public function isLoggingEnabled() |
||
148 | |||
149 | /** |
||
150 | * @return int |
||
151 | */ |
||
152 | public function getLogLevel() |
||
156 | |||
157 | /** |
||
158 | * @return array |
||
159 | */ |
||
160 | 2 | public function getExcludedIps() |
|
164 | |||
165 | /** |
||
166 | * @return boolean |
||
167 | */ |
||
168 | 2 | public function getXForwardedFor() |
|
172 | |||
173 | /** |
||
174 | * @return integer |
||
175 | **/ |
||
176 | 1 | public function getIdentificationIdentifier() |
|
180 | |||
181 | /** |
||
182 | * @param string $key |
||
183 | * @return mixed |
||
184 | * @throws Exception |
||
185 | */ |
||
186 | 11 | public function get($key) |
|
193 | } |
||
194 |