| @@ 304-321 (lines=18) @@ | ||
| 301 | * |
|
| 302 | * @return string the regular expression directive |
|
| 303 | */ |
|
| 304 | private function setRegexDirective($directive, $message1, $message2) |
|
| 305 | { |
|
| 306 | if (!$this->checker->setString($directive)->getString()) { |
|
| 307 | throw ServerException::forInvalidMatcher( |
|
| 308 | $directive, |
|
| 309 | $message1 |
|
| 310 | ); |
|
| 311 | } |
|
| 312 | ||
| 313 | if (!$this->checker->isValidRegex()) { |
|
| 314 | throw ServerException::forInvalidMatcher( |
|
| 315 | $directive, |
|
| 316 | $message2 |
|
| 317 | ); |
|
| 318 | } |
|
| 319 | ||
| 320 | return $directive; |
|
| 321 | } |
|
| 322 | ||
| 323 | /** |
|
| 324 | * Confirms if a directive matcher is a valid regex. |
|
| @@ 334-351 (lines=18) @@ | ||
| 331 | * |
|
| 332 | * @return bool true if the directive matcher is valid |
|
| 333 | */ |
|
| 334 | private function isValidDirective($directive, $message1, $message2) |
|
| 335 | { |
|
| 336 | if (!$this->checker->setString($directive)->getString()) { |
|
| 337 | throw ServerException::forInvalidMatcher( |
|
| 338 | $directive, |
|
| 339 | $message1 |
|
| 340 | ); |
|
| 341 | } |
|
| 342 | ||
| 343 | if (!$this->checker->hasKeyAndValueSubPattern()) { |
|
| 344 | throw ServerException::forInvalidMatcher( |
|
| 345 | $directive, |
|
| 346 | $message2 |
|
| 347 | ); |
|
| 348 | } |
|
| 349 | ||
| 350 | return true; |
|
| 351 | } |
|
| 352 | ||
| 353 | /** |
|
| 354 | * Gets the list of binaries that can be run to analyze. |
|