public function getMatch($method = null, $path = null)
    {
        $method = $method ?: $this->getRequestMethod();
        $path   = $path ?: $this->getRequestPath();

        $method = strtoupper($method);

        $methodNotAllowed = null;

        foreach ($this->routes as $pattern => $methods) {
            preg_match($this->regexifyPattern($pattern), $path, $matches);

            if ($matches) {
                $r = $this->getRouteObject($pattern, $method);

                if (!$r) {
                    // We found a match but with the wrong method
                    $methodNotAllowed = true;
                    continue;
                }

                $r->method = strtoupper($method);
                $r->args   = $this->getMatchArgs($matches);

                return $r;
            }
        }

        if ($methodNotAllowed) {
            if ($this->methodNotAllowed) {
                return (object)[
                    'before'   => [],
                    'after'    => [],
                    'args'     => [],
                    'callback' => &$this->methodNotAllowed,
                ];
            }

            throw new MethodNotAllowedException;
        }

        if ($this->notFound) {
            return (object)[
                'before'   => [],
                'after'    => [],
                'args'     => [],
                'callback' => &$this->notFound,
            ];
        }

        throw new NotFoundException;
    }