You are here

protected function Normalize::applyPattern in Bibliography Module 7.2

Apply a pattern if it has matched

Parameters

array $matches: Matches from Regex

array $pattern: Match Pattern

Return value

MatchObject New match Object with values applied

1 call to Normalize::applyPattern()
Normalize::checkPattern in lib/msrc-authortool/src/Nametools/Normalize.php
Check Pattern

File

lib/msrc-authortool/src/Nametools/Normalize.php, line 223

Class

Normalize
Normalize strings from common formats using REGEX

Namespace

Nametools

Code

protected function applyPattern($matches, $pattern) {
  $class = $this->matchObject;
  $outObj = $class::factory();
  $matches = array_slice($matches, 1);
  for ($i = 0; $i < count($matches); $i++) {
    $propName = $pattern[$i];
    $outObj->{$propName} = $matches[$i];
  }
  return $outObj;
}