Code Duplication    Length = 6-6 lines in 2 locations

components/Helper.php 2 locations

@@ 122-127 (lines=6) @@
119
            if ($user->can($r, $params)) {
120
                return true;
121
            }
122
            while (($pos = strrpos($r, '/')) > 0) {
123
                $r = substr($r, 0, $pos);
124
                if ($user->can($r . '/*', $params)) {
125
                    return true;
126
                }
127
            }
128
            return $user->can('/*', $params);
129
        } else {
130
            $routes = static::getRoutesByUser($userId);
@@ 134-139 (lines=6) @@
131
            if (isset($routes[$r])) {
132
                return true;
133
            }
134
            while (($pos = strrpos($r, '/')) > 0) {
135
                $r = substr($r, 0, $pos);
136
                if (isset($routes[$r . '/*'])) {
137
                    return true;
138
                }
139
            }
140
            return isset($routes['/*']);
141
        }
142
    }