private function checkMatches(string $uri, string $method): array
    {
        return array_map(
            function($regexp, $route) use ($uri, $method) {
                $match = preg_match_all($regexp, $uri, $matches);

                // If something found and method is correct
                if ($match && $route->checkMethod($method)) {
                    // Set array of variables
                    $route->setVariables($matches);
                    return $route;
                }
                return null;
            },
            // Array with keys
            $this->getRoutes(true),
            // Array with values
            $this->getRoutes()
        );
    }
private function checkMatches(string $uri, string $method): array
    {
        return array_map(
            function($regexp, $route) use ($uri, $method) {
                $match = preg_match_all($regexp, $uri, $matches);

                // If something found and method is correct
                if ($match && $route->checkMethod($method)) {
                    // Set array of variables
                    $route->setVariables($matches);
                    return $route;
                }
                return null;
            },
            // Array with keys
            $this->getRoutes(true),
            // Array with values
            $this->getRoutes()
        );
    }
private function checkMatches ( string $ uri , string $ method ) : array { return array_map ( function ( $ regexp , $ route ) use ( $ uri , $ method ) { $ match = preg_match_all ( $ regexp , $ uri , $ matches ) ; // If something found and method is correct if ( $ match && $ route -> checkMethod ( $ method ) ) { // Set array of variables $ route -> setVariables ( $ matches ) ; return $ route ; } return null ; } , // Array with keys $ this -> getRoutes ( true ) , // Array with values $ this -> getRoutes ( ) ) ; }
Find route object by URL nad method

@param   string $uri
@param   string $method
@return  array
Find route object by URL nad method