Mapper::reverse PHP Method

reverse() public static method

public static reverse ( $path )
    public static function reverse($path)
    {
        $here = self::parse();
        $params = $here['named'];
        $path = array_merge(array('prefix' => $here['prefix'], 'controller' => $here['controller'], 'action' => $here['action'], 'params' => $here['params']), $params, $path);
        $nonParams = array('prefix', 'controller', 'action', 'params');
        $url = '';
        foreach ($path as $key => $value) {
            if (!in_array($key, $nonParams)) {
                $url .= '/' . $key . ':' . $value;
            } else {
                if (!is_null($value)) {
                    if ($key == 'action' && ($filtered = self::filterAction($value))) {
                        $value = $filtered['action'];
                    } else {
                        if ($key == 'params') {
                            $value = join('/', $value);
                        }
                    }
                    $url .= '/' . $value;
                }
            }
        }
        return $url;
    }