You are here

public function HumanNameParser_Parser::parseName in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/Parser.php \HumanNameParser_Parser::parseName()

File

includes/Parser.php, line 44

Class

HumanNameParser_Parser
Works with a Name object to parse out the parts of a name.

Code

public function parseName($name = NULL, $category = NULL) {
  $this->literal = 0;
  $this->category = 1;
  $this->type = 1;
  if (is_array($name) && isset($name['name'])) {
    if (isset($name['auth_category']) && !empty($name['auth_category']) && empty($category)) {
      $this->category = $name['auth_category'];
    }
    elseif (!empty($category)) {
      $this->category = $category;
    }
    if (isset($name['auth_type']) && !empty($name['auth_type'])) {
      $this->type = $name['auth_type'];
    }
    $this->nameParts = $name;
    $this
      ->setName($name['name'], $category);
  }
  else {
    $this->nameParts['name'] = $name;
    $this
      ->setName($name, $category);
  }
  return $this
    ->getArray();
}