/** * Import variables from the environment with a given map * * of values and types. * @param string $map URL Prototype * @returns array of paramethers with their values */ public function map($map) { $this->params = parent::map(rtrim($this->base_map, '/') . '/' . ltrim($map, '/')); return $this->params; }
function run_test() { $_GET['route'] = "something/lost/and/neverseen"; $tests = array('/module=alpha/base=alpha?explicit=int&var=int', '/module=alpha/base=alpha', '?explicit=int&var=int'); foreach ($tests as $test) { $url = new url_handler(); $params = $url->map($test); print_r($params); } echo $url->create('/module=something/base=lost?explicit=7&var=9') . '<br />'; echo $url->create('/module=something/base=lost') . '<br />'; echo $url->create('?explicit=7&var=9') . '<br />'; }