Assign or remove items
@param array $routes
@return array
494136
public function remove($routes)
    {
        $manager = Configs::authManager();
        foreach ($routes as $route) {
            try {
                $item = $manager->createPermission($this->getPermissionName($route));   ///[yii2-brainbase v0.3.0 (admin:rbac):fix Added multi app (frontend/backend)]@see https://github.com/mdmsoft/yii2-admin/pull/309/
                $manager->remove($item);
            } catch (\Exception $exc) {
                Yii::error($exc->getMessage(), __METHOD__);
            }
        }
        Helper::invalidate();
    }
1124515
public static function all( $routes ) 
	{

		/* Call all functions that are to be executed before routing */
		foreach( self::$beforeFuncs as $beforeFunc ) {
			if( $beforeFunc[1] ) {
				call_user_func_array( $beforeFunc[0] , $beforeFunc[1] );
			} else {
				call_user_func( $beforeFunc[0] );
			}
		}

		self::$routes = $routes;
		$method = strtolower($_SERVER['REQUEST_METHOD']);
		$path = '/';
		$handler = null;
		$matched = array();
		if ( !empty ( $_SERVER['PATH_INFO'] ) ) {
			$path = $_SERVER['PATH_INFO'];
		} else if ( !empty ( $_SERVER['REQUEST_URI'] ) ) {
            $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
		}

		if ( isset($routes[$path] ) ) {
			if( is_array( $routes[$path] ) ) {
				$handler = $routes[$path][0];
			} else {
				$handler = $routes[$path];
			}
		} else if ( $routes ) {
			
			$regex = array(
				'/{i}/',
				'/{s}/',
				'/{a}/'
				);

			$replacements = array(
				'([\d]+)'	,
				'([a-zA-Z]+)',
				'([\w-]+)'
				);

			foreach ( $routes as $routePath => $routeDesc ){
				$routePath = preg_replace( $regex, $replacements, $routePath );
				if( preg_match( '#^/?' . $routePath . '/?$#', $path, $matches ) ){
					if( is_array( $routeDesc ) ) {
						$handler = $routeDesc[0];
						if( isset( $routeDesc[2] )) {
							$middleware = $routeDesc[2];
						}
					}
					else 
						$handler = $routeDesc;
					$matched = $matches;
					break;
				}
			}
		}
		unset( $matched[0] );

		if( isset($middleware) ){
			$newMatched = self::callFunction( $middleware, $matched, $method );
			/* If new wildcard param are there pass them to main handler */
			if( $newMatched ) { 
				self::callFunction( $handler, $newMatched, $method );
			} else {
				self::callFunction( $handler, $matched, $method );
			}
		} else {
			self::callFunction( $handler, $matched, $method );
		}

		/* Call all the function that are to be executed after routing */
		foreach( self::$afterFuncs as $afterFunc )
			if( $afterFunc[1] ) {
				call_user_func_array( $afterFunc[0] , $afterFunc[1] );
			} else {
				call_user_func( $afterFunc[0] );
			}
	}
528189
public function remove($routes)
    {
        $manager = Yii::$app->getAuthManager();
        foreach ($routes as $route) {
            try {
                $item = $manager->createPermission('/' . trim($route, '/'));
                $manager->remove($item);
            } catch (Exception $exc) {
                Yii::error($exc->getMessage(), __METHOD__);
            }
        }
        Helper::invalidate();
    }
626197
public function addRoutes(array $routes)
    {
        foreach($routes as $name => $routeData)
            $this->addRoute($this->factory->createRoute($this, $name, $routeData));

        return $this;
    }
1373586
public function delete($paths)
		{
			$paths = Arrays::is($paths) ? $paths : func_get_args();

			$success = true;

			foreach ($paths as $path) { if ( ! @unlink($path)) $success = false; }

			return $success;
		}
238614
protected function checkRoutesValidity(array $routes): void
    {
        $requiredRouteKeys = ['index'];
        $optionalRouteKeys = ['create', 'edit', 'destroy'];
        $allowedRouteKeys = array_merge($requiredRouteKeys, $optionalRouteKeys);
        $this->checkRequiredRoutesValidity($routes, $requiredRouteKeys);
        $this->checkAllowedRoutesValidity($routes, $allowedRouteKeys);
        $this->checkRoutesStructureValidity($routes);
    }
192756
public function actionRemove(): array
    {
        $routes = Yii::$app->getRequest()->post('routes', []);
        $model = Yii::createObject($this->modelClass);
        $model->remove($routes);

        return $model->getAvailableAndAssignedRoutes();
    }
1201004
public function setRoutes(array $routes): TableList
    {
        $this->checkRoutesValidity($routes);
        $this->setAttribute('routes', $routes);

        return $this;
    }
951293
protected function filterRoute(array $route)
    {
        $filters = ['name', 'path', 'protected', 'unprotected', 'versions', 'scopes'];

        foreach ($filters as $filter) {
            if ($this->option($filter) && ! $this->{'filterBy'.ucfirst($filter)}($route)) {
                return;
            }
        }

        return $route;
    }
468833
public function addRoutes(array $routes)
    {
        foreach ($routes as $route => $endpoint) {
            // Add route as key. Use rtrim to remove any existing trailing slash, and then
            // add a new trailing slash
            $route = ($route !== '/') ? rtrim($route, '/') : '/';
            $this->routes[$route] = $endpoint;
        }
    }
23383
public function isRoute($routes)
    {
        $routes = is_array($routes) ? $routes : func_get_args();

        return call_user_func_array([$this->router, 'is'], $routes);
    }
293125
public function match(string $route): array
    {
        if (!isset($this->routes[$route])) {
            return [];
        }

        return $this->routes[$route];
    }
1250041
protected function getRouteActions($routes)
    {
        $actions = array();

        // iterate for all routes
        foreach ($routes->all() as $route){

            // if route is post and is direct exposed
            if (in_array('POST', $route->getMethods()) == true && $route->isDirect()){
                $apiParts = $this->getRouteApiParts($route);

                if ($apiParts['exposed']){
                    $path = $apiParts['path'];
                    unset($apiParts['path']);
                    unset($apiParts['exposed']);

                    $actions[$path][] = $apiParts;
                }
            }

        }

        return $actions;
    }
63229
public function addRoutes(array $routes)
    {
        foreach ($routes as $name => $route) {
            $this->addRoute($name, $route);
        }
        return $this;
    }
295004
private function setRoutes(array $routes)
    {
        $this->routes = [];

        foreach ($routes as $name => $route) {
            $this->add($name, $route);
        }
    }
912227
public function addRoutes(array $routes)
    {
        /** @var Route[] $routesTranform */
        $routesTranform = [];

        foreach ($routes as $name => $route) {
            if (is_string($route)) {
                $routesTranform[$name] = new Route($route);
            } elseif ($route instanceof Group) {
                $routesTranform = array_merge($routesTranform, $this->addGroup($route));
            } else {
                $routesTranform[$name] = $route;
            }
        }

        foreach ($routesTranform as $name => $route) {
            if (!$route->getName() && !$route->getResponseCode()) {
                $route->setName($name);
            }

            if (!$route instanceof Route) {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid route, got %s',
                    is_object($route) ? get_class($route) : gettype($route)
                ));
            }

            if (!$route->getName() && !$route->getResponseCode()) {
                throw new \InvalidArgumentException('Missing route name');
            }

            if (isset($this->routes[$route->getName()])) {
                throw new \InvalidArgumentException(sprintf("Duplicate route name '%s'", $route->getName()));
            }

            if ($route->getResponseCode()) {
                $this->errors[$route->getResponseCode()] = $route;
            } else {
                $this->routes[$route->getName()] = $route;
            }
        }
    }
842230
public function gatherRouteMiddlewares($route)
    {
        if (method_exists($this->router, 'gatherRouteMiddleware')) {
            return $this->router->gatherRouteMiddleware($route);
        }

        return $this->router->gatherRouteMiddlewares($route);
    }