bedezign\yii2\audit\Audit::routeMatches PHP Method

routeMatches() protected method

Entries in the list are allowed to end with a '*', which means that a substring will be used for the match instead of a full compare.
protected routeMatches ( string $route, string[] $list ) : boolean
$route string An application rout
$list string[] List of routes to compare against.
return boolean
    protected function routeMatches($route, $list)
    {
        $list = ArrayHelper::toArray($list);
        foreach ($list as $compare) {
            $len = strlen($compare);
            if ($compare[$len - 1] == '*') {
                $compare = rtrim($compare, '*');
                if (substr($route, 0, $len - 1) === $compare) {
                    return true;
                }
            }
            if ($compare[0] == '*') {
                $compare = ltrim($compare, '*');
                if (substr($route, -($len - 1)) === $compare) {
                    return true;
                }
            }
            if ($route === $compare) {
                return true;
            }
        }
        return false;
    }