src/Storage/FileStorage.php
public static function getItemByUrl($items, $url)
    {
        if (!isset($items)) {
            return null;
        }

        // Check for the exact rule
        if (array_key_exists("/" . $url, $items)) {
            return $items["/" . $url];
        }

        $urlParts = explode("/", trim($url, "/"));
        $urlPartsLen = count($urlParts);

        while ($urlPartsLen > 0) {
            unset($urlParts[--$urlPartsLen]);

            $subUrl = "/" . join("/", $urlParts);

            // Use the higher level rule, if it doesn't have deactivated recursive application
            if (array_key_exists($subUrl, $items)
                && (!isset($items[$subUrl]["recursive"])
                        || $items[$subUrl]["recursive"]===true)) {
                return $items[$subUrl];
            }
        }

        return null;
    }
public static function getItemByUrl($items, $url)
    {
        if (!isset($items)) {
            return null;
        }

        // Check for the exact rule
        if (array_key_exists("/" . $url, $items)) {
            return $items["/" . $url];
        }

        $urlParts = explode("/", trim($url, "/"));
        $urlPartsLen = count($urlParts);

        while ($urlPartsLen > 0) {
            unset($urlParts[--$urlPartsLen]);

            $subUrl = "/" . join("/", $urlParts);

            // Use the higher level rule, if it doesn't have deactivated recursive application
            if (array_key_exists($subUrl, $items)
                && (!isset($items[$subUrl]["recursive"])
                        || $items[$subUrl]["recursive"]===true)) {
                return $items[$subUrl];
            }
        }

        return null;
    }
Get item by URL

Find an item that applies to a given url
Url keys must begin with a /

@param array|null $items
@param string $url
@return array|null