public function match($uri)
    {
        // Normalization of the url of the nagivator.
        if (preg_match('~(.*)/$~', $uri, $match)) {
            $uri = end($match);
        }

        // Normalization of the path defined by the programmer.
        if (preg_match('~(.*)/$~', $this->path, $match)) {
            $this->path = end($match);
        }

        // We go straight back to gain performance.
        if ($this->path === $uri) {
            return true;
        }

        // We check the length of the path defined by the programmer
        // with that of the current url in the user's browser.
        $path = implode('', preg_split('/(\/:[a-z0-9-_]+\?)/', $this->path));

        if (count(explode('/', $path)) != count(explode('/', $uri))) {
            if (count(explode('/', $this->path)) != count(explode('/', $uri))) {
                return false;
            }
        }

        // Copie de l'url
        $path = $uri;

        // In case the developer did not add of constraint on captured variables
        if (empty($this->with)) {
            $path = preg_replace('~:\w+(\?)?~', '([^\s]+)$1', $this->path);

            preg_match_all('~:([a-z-0-9_-]+?)\?~', $this->path, $this->keys);

            $this->keys = end($this->keys);

            return $this->checkRequestUri($path, $uri);
        }

        // In case the developer has added constraints
        // on the captured variables
        if (!preg_match_all('~:([\w]+)?~', $this->path, $match)) {
            return $this->checkRequestUri($path, $uri);
        }

        $tmp_path = $this->path;

        $this->keys = end($match);

        // Association of criteria personalized.
        foreach ($this->keys as $key) {
            if (array_key_exists($key, $this->with)) {
                $tmp_path = preg_replace('~:' . $key . '~', '(' . $this->with[$key] . ')', $tmp_path);
            }
        }

        // Clear the custom criteria association table.
        $this->with = [];

        // In the case where the different path one recovers, one recovers the one in $tmp_path
        if ($tmp_path != $this->path) {
            $path = $tmp_path;
        }

        // Url check and path PARSER
        return $this->checkRequestUri($path, $uri);
    }
public function match($uri)
    {
        // Normalization of the url of the nagivator.
        if (preg_match('~(.*)/$~', $uri, $match)) {
            $uri = end($match);
        }

        // Normalization of the path defined by the programmer.
        if (preg_match('~(.*)/$~', $this->path, $match)) {
            $this->path = end($match);
        }

        // We go straight back to gain performance.
        if ($this->path === $uri) {
            return true;
        }

        // We check the length of the path defined by the programmer
        // with that of the current url in the user's browser.
        $path = implode('', preg_split('/(\/:[a-z0-9-_]+\?)/', $this->path));

        if (count(explode('/', $path)) != count(explode('/', $uri))) {
            if (count(explode('/', $this->path)) != count(explode('/', $uri))) {
                return false;
            }
        }

        // Copie de l'url
        $path = $uri;

        // In case the developer did not add of constraint on captured variables
        if (empty($this->with)) {
            $path = preg_replace('~:\w+(\?)?~', '([^\s]+)$1', $this->path);

            preg_match_all('~:([a-z-0-9_-]+?)\?~', $this->path, $this->keys);

            $this->keys = end($this->keys);

            return $this->checkRequestUri($path, $uri);
        }

        // In case the developer has added constraints
        // on the captured variables
        if (!preg_match_all('~:([\w]+)?~', $this->path, $match)) {
            return $this->checkRequestUri($path, $uri);
        }

        $tmp_path = $this->path;

        $this->keys = end($match);

        // Association of criteria personalized.
        foreach ($this->keys as $key) {
            if (array_key_exists($key, $this->with)) {
                $tmp_path = preg_replace('~:' . $key . '~', '(' . $this->with[$key] . ')', $tmp_path);
            }
        }

        // Clear the custom criteria association table.
        $this->with = [];

        // In the case where the different path one recovers, one recovers the one in $tmp_path
        if ($tmp_path != $this->path) {
            $path = $tmp_path;
        }

        // Url check and path PARSER
        return $this->checkRequestUri($path, $uri);
    }
public function match ( $ uri ) { // Normalization of the url of the nagivator. if ( preg_match ( '~(.*)/$~' , $ uri , $ match ) ) { $ uri = end ( $ match ) ; } // Normalization of the path defined by the programmer. if ( preg_match ( '~(.*)/$~' , $ this -> path , $ match ) ) { $ this -> path = end ( $ match ) ; } // We go straight back to gain performance. if ( $ this -> path === $ uri ) { return true ; } // We check the length of the path defined by the programmer // with that of the current url in the user's browser. $ path = implode ( '' , preg_split ( '/(\/:[a-z0-9-_]+\?)/' , $ this -> path ) ) ; if ( count ( explode ( '/' , $ path ) ) != count ( explode ( '/' , $ uri ) ) ) { if ( count ( explode ( '/' , $ this -> path ) ) != count ( explode ( '/' , $ uri ) ) ) { return false ; } } // Copie de l'url $ path = $ uri ; // In case the developer did not add of constraint on captured variables if ( empty ( $ this -> with ) ) { $ path = preg_replace ( '~:\w+(\?)?~' , '([^\s]+)$1' , $ this -> path ) ; preg_match_all ( '~:([a-z-0-9_-]+?)\?~' , $ this -> path , $ this -> keys ) ; $ this -> keys = end ( $ this -> keys ) ; return $ this -> checkRequestUri ( $ path , $ uri ) ; } // In case the developer has added constraints // on the captured variables if ( ! preg_match_all ( '~:([\w]+)?~' , $ this -> path , $ match ) ) { return $ this -> checkRequestUri ( $ path , $ uri ) ; } $ tmp_path = $ this -> path ; $ this -> keys = end ( $ match ) ; // Association of criteria personalized. foreach ( $ this -> keys as $ key ) { if ( array_key_exists ( $ key , $ this -> with ) ) { $ tmp_path = preg_replace ( '~:' . $ key . '~' , '(' . $ this -> with [ $ key ] . ')' , $ tmp_path ) ; } } // Clear the custom criteria association table. $ this -> with = [ ] ; // In the case where the different path one recovers, one recovers the one in $tmp_path if ( $ tmp_path != $ this -> path ) { $ path = $ tmp_path ; } // Url check and path PARSER return $ this -> checkRequestUri ( $ path , $ uri ) ; }
Lets check if the url of the query is
conform to that defined by the router

@param  string $uri
@return bool
Lets check if the url of the query is conform to that defined by the router