You are here

public function purl_pair::parse in Persistent URL 7

Same name and namespace in other branches
  1. 6 includes/purl_pair.inc \purl_pair::parse()

Tear apart the path and iterate thought it looking for valid values.

Overrides purl_path::parse

File

includes/purl_pair.inc, line 26

Class

purl_pair
Pair pair prefixer.

Code

public function parse($valid_values, $q) {
  $parsed = array();
  $args = explode('/', $q);
  $arg = $args[0];
  while (isset($valid_values[$arg])) {
    $parsed[$arg] = $valid_values[$arg];
    array_shift($args);
    $parsed[$arg]['id'] = array_shift($args);
    $arg = $args[0];
    if (in_array($arg, $parsed)) {
      break;
    }
  }
  return purl_path_elements($this, $parsed);
}