src/UrlHandlers/LeafRestUrlHandler.php
protected function getMatchingUrlFragment(Request $request, $currentUrlFragment = "")
    {
        $uri = $currentUrlFragment;

        $parentResponse = parent::getMatchingUrlFragment($request, $currentUrlFragment);

        if (preg_match('|^' . $this->url . '([0-9]+)/([a-zA-Z0-9\-]+)|', $uri, $matches)) {
            if ($this->checkForPotentialAction($matches[2])) {
                $this->urlAction = $matches[2];
                $this->isCollection = false;

                return $matches[0];
            }
        }

        if (preg_match("|^" . $this->url . "([^/]+)/|", $uri, $match)) {
            if (is_numeric($match[1]) || isset($this->additionalLeafClassNameMap[$match[1]])) {
                $this->urlAction = $match[1];
                $this->isCollection = false;

                return $match[0];
            }
        }

        return $parentResponse;
    }
protected function getMatchingUrlFragment(Request $request, $currentUrlFragment = "")
    {
        $uri = $currentUrlFragment;

        $parentResponse = parent::getMatchingUrlFragment($request, $currentUrlFragment);

        if (preg_match('|^' . $this->url . '([0-9]+)/([a-zA-Z0-9\-]+)|', $uri, $matches)) {
            if ($this->checkForPotentialAction($matches[2])) {
                $this->urlAction = $matches[2];
                $this->isCollection = false;

                return $matches[0];
            }
        }

        if (preg_match("|^" . $this->url . "([^/]+)/|", $uri, $match)) {
            if (is_numeric($match[1]) || isset($this->additionalLeafClassNameMap[$match[1]])) {
                $this->urlAction = $match[1];
                $this->isCollection = false;

                return $match[0];
            }
        }

        return $parentResponse;
    }
Should be implemented to return a true or false as to whether this handler supports the given request.

Normally this involves testing the request URI.

@param Request $request
@param string $currentUrlFragment
@return bool