Back to RouterLegacy class

Method parse

public array
parse
(mixed &$segments)
Generic parse function for missing or legacy component router
Parameters
  • array & $segments The segments of the URL to parse.
Returns
  • array The URL attributes to be used by the application.
Since
  • 3.3
Class: RouterLegacy
Project: Joomla

Method parse - Source code

/**
 * Generic parse function for missing or legacy component router
 *
 * @param   array  &$segments  The segments of the URL to parse.
 *
 * @return  array  The URL attributes to be used by the application.
 *
 * @since   3.3
 */
public function parse(&$segments)
{
    $function = $this->component . 'ParseRoute';
    if (\function_exists($function)) {
        $total = \count($segments);
        for ($i = 0; $i < $total; $i++) {
            $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1);
        }
        return $function($segments);
    }
    return array();
}