src/Pupcake/Router.php
public function findMatchedRoute($request_method = "", $query_path = "", $route_map)
    {
        $query_path = $this->normalize($query_path);

        $request_matched = false;
        $output = "";
        if (count($route_map) > 0) {
            $request_types = array_keys($route_map);
            $request_types_to_lookup = array();
            foreach ($request_types as $request_type) {
                if ($request_type == $request_method || $request_type == "*") {
                    $request_types_to_lookup[] = $request_type;
                }
            }
            foreach ($request_types_to_lookup as $request_type) {
                if (isset($route_map[$request_type]) && count($route_map[$request_type]) > 0) {
                    foreach ($route_map[$request_type] as $route_pattern => $route) {
                        //once we found there is a matched route, stop
                        $matched = $this->routeMatched($request_type, $route_pattern, $query_path);
                        if ($matched) {
                            $request_matched = true;
                            break 2;
                        }
                    }
                }
            }
        }

        return $request_matched;
    }
public function findMatchedRoute($request_method = "", $query_path = "", $route_map)
    {
        $query_path = $this->normalize($query_path);

        $request_matched = false;
        $output = "";
        if (count($route_map) > 0) {
            $request_types = array_keys($route_map);
            $request_types_to_lookup = array();
            foreach ($request_types as $request_type) {
                if ($request_type == $request_method || $request_type == "*") {
                    $request_types_to_lookup[] = $request_type;
                }
            }
            foreach ($request_types_to_lookup as $request_type) {
                if (isset($route_map[$request_type]) && count($route_map[$request_type]) > 0) {
                    foreach ($route_map[$request_type] as $route_pattern => $route) {
                        //once we found there is a matched route, stop
                        $matched = $this->routeMatched($request_type, $route_pattern, $query_path);
                        if ($matched) {
                            $request_matched = true;
                            break 2;
                        }
                    }
                }
            }
        }

        return $request_matched;
    }
public function findMatchedRoute ( $ request_method = "" , $ query_path = "" , $ route_map ) { $ query_path = $ this -> normalize ( $ query_path ) ; $ request_matched = false ; $ output = "" ; if ( count ( $ route_map ) > 0 ) { $ request_types = array_keys ( $ route_map ) ; $ request_types_to_lookup = array ( ) ; foreach ( $ request_types as $ request_type ) { if ( $ request_type == $ request_method || $ request_type == "*" ) { $ request_types_to_lookup [ ] = $ request_type ; } } foreach ( $ request_types_to_lookup as $ request_type ) { if ( isset ( $ route_map [ $ request_type ] ) && count ( $ route_map [ $ request_type ] ) > 0 ) { foreach ( $ route_map [ $ request_type ] as $ route_pattern => $ route ) { //once we found there is a matched route, stop $ matched = $ this -> routeMatched ( $ request_type , $ route_pattern , $ query_path ) ; if ( $ matched ) { $ request_matched = true ; break 2 ; } } } } } return $ request_matched ; }
find a route
find a route