@@ 285-302 (lines=18) @@ | ||
282 | * |
|
283 | * @return string the regular expression directive |
|
284 | */ |
|
285 | private function setRegexDirective($directive, $message1, $message2) |
|
286 | { |
|
287 | if (!$this->checker->setString($directive)->getString()) { |
|
288 | throw ServerException::forInvalidMatcher( |
|
289 | $directive, |
|
290 | $message1 |
|
291 | ); |
|
292 | } |
|
293 | ||
294 | if (!$this->checker->isValidRegex()) { |
|
295 | throw ServerException::forInvalidMatcher( |
|
296 | $directive, |
|
297 | $message2 |
|
298 | ); |
|
299 | } |
|
300 | ||
301 | return $directive; |
|
302 | } |
|
303 | ||
304 | /** |
|
305 | * Confirms if a directive matcher is a valid regex. |
|
@@ 315-332 (lines=18) @@ | ||
312 | * |
|
313 | * @return bool true if the directive matcher is valid |
|
314 | */ |
|
315 | private function isValidDirective($directive, $message1, $message2) |
|
316 | { |
|
317 | if (!$this->checker->setString($directive)->getString()) { |
|
318 | throw ServerException::forInvalidMatcher( |
|
319 | $directive, |
|
320 | $message1 |
|
321 | ); |
|
322 | } |
|
323 | ||
324 | if (!$this->checker->hasKeyAndValueSubPattern()) { |
|
325 | throw ServerException::forInvalidMatcher( |
|
326 | $directive, |
|
327 | $message2 |
|
328 | ); |
|
329 | } |
|
330 | ||
331 | return true; |
|
332 | } |
|
333 | ||
334 | /** |
|
335 | * Gets the list of binaries that can be run to analyze. |