public function match($query)
    {
        $ruleParts  = explode('/', $this->rule);
        $queryParts = explode('/', $query);

        $ruleCount = count($ruleParts);
        //$querCount = count($queryParts);
        
        $match = false;
        for ($i = 0; $i < $ruleCount; $i++) {
            $rp = $ruleParts[$i];
            $qp = isset($queryParts[$i]) ? $queryParts[$i] : null;
            
            $first = isset($rp[0]) ? $rp[0] : '';
            switch ($first) {
                case '*':
                    $match = true;
                    break;
                
                default:
                    $match = ($rp == $qp);
                    break;
            }
            
            if (!$match) {
                return false;
            }
        }
        
        //echo "$this->rule == $query\n";
        return true;
    }
public function match($query)
    {
        $ruleParts  = explode('/', $this->rule);
        $queryParts = explode('/', $query);

        $ruleCount = count($ruleParts);
        //$querCount = count($queryParts);
        
        $match = false;
        for ($i = 0; $i < $ruleCount; $i++) {
            $rp = $ruleParts[$i];
            $qp = isset($queryParts[$i]) ? $queryParts[$i] : null;
            
            $first = isset($rp[0]) ? $rp[0] : '';
            switch ($first) {
                case '*':
                    $match = true;
                    break;
                
                default:
                    $match = ($rp == $qp);
                    break;
            }
            
            if (!$match) {
                return false;
            }
        }
        
        //echo "$this->rule == $query\n";
        return true;
    }
public function match ( $ query ) { $ ruleParts = explode ( '/' , $ this -> rule ) ; $ queryParts = explode ( '/' , $ query ) ; $ ruleCount = count ( $ ruleParts ) ; //$querCount = count($queryParts); $ match = false ; for ( $ i = 0 ; $ i < $ ruleCount ; $ i ++ ) { $ rp = $ ruleParts [ $ i ] ; $ qp = isset ( $ queryParts [ $ i ] ) ? $ queryParts [ $ i ] : null ; $ first = isset ( $ rp [ 0 ] ) ? $ rp [ 0 ] : '' ; switch ( $ first ) { case '*' : $ match = true ; break ; default : $ match = ( $ rp == $ qp ) ; break ; } if ( ! $ match ) { return false ; } } //echo "$this->rule == $query\n"; return true ; }
Check if the route matches a query

@param string $query to match against

@return boolean true if query matches the route
Check if the route matches a query