@@ 489-512 (lines=24) @@ | ||
486 | * @param $against |
|
487 | * @return null |
|
488 | */ |
|
489 | protected function modelMatch($tests, $against) |
|
490 | { |
|
491 | // Model match must be an array. |
|
492 | if (!is_array($tests) || !count($tests)) { |
|
493 | return null; |
|
494 | } |
|
495 | ||
496 | $this->setRegexErrorHandler(); |
|
497 | ||
498 | foreach ($tests as $test) { |
|
499 | $regex = $this->prepareRegex($test); |
|
500 | ||
501 | if ($this->regexMatch($regex, $against, $matches)) { |
|
502 | // If the match contained a model, save it. |
|
503 | if (isset($matches['model'])) { |
|
504 | $this->restoreRegexErrorHandler(); |
|
505 | return $matches['model']; |
|
506 | } |
|
507 | } |
|
508 | } |
|
509 | ||
510 | $this->restoreRegexErrorHandler(); |
|
511 | return null; |
|
512 | } |
|
513 | ||
514 | protected function versionMatch($tests, $against) |
|
515 | { |
|
@@ 514-537 (lines=24) @@ | ||
511 | return null; |
|
512 | } |
|
513 | ||
514 | protected function versionMatch($tests, $against) |
|
515 | { |
|
516 | // Model match must be an array. |
|
517 | if (!is_array($tests) || !count($tests)) { |
|
518 | return null; |
|
519 | } |
|
520 | ||
521 | $this->setRegexErrorHandler(); |
|
522 | ||
523 | foreach ($tests as $test) { |
|
524 | $regex = $this->prepareRegex($test); |
|
525 | ||
526 | if ($this->regexMatch($regex, $against, $matches)) { |
|
527 | // If the match contained a version, save it. |
|
528 | if (isset($matches['version'])) { |
|
529 | $this->restoreRegexErrorHandler(); |
|
530 | return $this->prepareVersion($matches['version']); |
|
531 | } |
|
532 | } |
|
533 | } |
|
534 | ||
535 | $this->restoreRegexErrorHandler(); |
|
536 | return null; |
|
537 | } |
|
538 | ||
539 | protected function matchEntity($entity, $tests, $against) |
|
540 | { |