| @@ 278-295 (lines=18) @@ | ||
| 275 | * |
|
| 276 | * @return string the regular expression directive |
|
| 277 | */ |
|
| 278 | private function setRegexDirective($directive, $message1, $message2) |
|
| 279 | { |
|
| 280 | if (!$this->checker->setString($directive)->getString()) { |
|
| 281 | throw ServerException::forInvalidMatcher( |
|
| 282 | $directive, |
|
| 283 | $message1 |
|
| 284 | ); |
|
| 285 | } |
|
| 286 | ||
| 287 | if (!$this->checker->isValidRegex()) { |
|
| 288 | throw ServerException::forInvalidMatcher( |
|
| 289 | $directive, |
|
| 290 | $message2 |
|
| 291 | ); |
|
| 292 | } |
|
| 293 | ||
| 294 | return $directive; |
|
| 295 | } |
|
| 296 | ||
| 297 | /** |
|
| 298 | * Confirms if a directive matcher is a valid regex. |
|
| @@ 308-325 (lines=18) @@ | ||
| 305 | * |
|
| 306 | * @return bool true if the directive matcher is valid |
|
| 307 | */ |
|
| 308 | private function isValidDirective($directive, $message1, $message2) |
|
| 309 | { |
|
| 310 | if (!$this->checker->setString($directive)->getString()) { |
|
| 311 | throw ServerException::forInvalidMatcher( |
|
| 312 | $directive, |
|
| 313 | $message1 |
|
| 314 | ); |
|
| 315 | } |
|
| 316 | ||
| 317 | if (!$this->checker->hasKeyAndValueSubPattern()) { |
|
| 318 | throw ServerException::forInvalidMatcher( |
|
| 319 | $directive, |
|
| 320 | $message2 |
|
| 321 | ); |
|
| 322 | } |
|
| 323 | ||
| 324 | return true; |
|
| 325 | } |
|
| 326 | ||
| 327 | /** |
|
| 328 | * Gets the list of binaries that can be run to analyze. |
|