public function getRoute($url = '', $fqr = true)
    {
        if (!is_array($url)) {
            if (strpos($url, 'http') === 0) {
                return $url;
            }

            if (strpos($url, '/') === 0) {
                return route($url);
            }

            $url = str_replace('index.php?', '', trim($url));
            $vars = array();
            parse_str($url, $vars);
            $url = $vars;
        }

        $parts = array();

        if (!isset($url['option'])) {
            $parts['option'] = AnRequest::get('get.option', 'cmd');
        }

        //if not view is set the set
        if (!isset($url['view'])) {
            $parts['view'] = AnRequest::get('get.view', 'cmd');

            //only try to set the layout if we are setting the view
            if (!isset($url['layout']) && AnRequest::has('get.layout')) {
                $parts['layout'] = AnRequest::get('get.layout', 'cmd');
            }
        }

        //carry format
        if (!isset($url['format']) && AnRequest::has('get.format')) {
            $parts['format'] = AnRequest::get('get.format', 'cmd');
        }

        foreach ($parts as $key => $value) {
            $url[$key] = $value;
        }

        //unset html format since it's a default
        if (isset($url['format']) && $url['format'] == 'html') {
            unset($url['format']);
        }

        //unset default lyout since it's a default
        if (isset($url['layout']) && $url['layout'] == 'default') {
            unset($url['layout']);
        }

        $parts = 'index.php?'.http_build_query($url);
        
        $route = $this->getService('application')->getRouter()->build($parts, $fqr);

        return $route;
    }