You are here

public function purl_path::parse in Persistent URL 6

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

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

Overrides purl_processor::parse

1 method overrides purl_path::parse()
purl_pair::parse in includes/purl_pair.inc
Tear apart the path and iterate thought it looking for valid values.

File

includes/purl_path.inc, line 28

Class

purl_path
Path prefixer.

Code

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