public function prepandRoutes(IRouter $router, array $routes): void
	{
		if (empty($routes)) {
			return;
		}

		if (!($router instanceof \Traversable) || !($router instanceof \ArrayAccess)) {
			throw new ApiRouteWrongRouterException(sprintf(
				'ApiRoutesResolver can not add ApiRoutes to your router. Use for example %s instead',
				RouteList::class
			));
		}

		$user_routes = $this->findAndDestroyUserRoutes($router);

		/**
		 * Add ApiRoutes first
		 */
		foreach ($routes as $route) {
			$router[] = $route;
		}

		/**
		 * User routes on second place
		 */
		foreach ($user_routes as $route) {
			$router[] = $route;
		}
	}
public function prepandRoutes(IRouter $router, array $routes): void
	{
		if (empty($routes)) {
			return;
		}

		if (!($router instanceof \Traversable) || !($router instanceof \ArrayAccess)) {
			throw new ApiRouteWrongRouterException(sprintf(
				'ApiRoutesResolver can not add ApiRoutes to your router. Use for example %s instead',
				RouteList::class
			));
		}

		$user_routes = $this->findAndDestroyUserRoutes($router);

		/**
		 * Add ApiRoutes first
		 */
		foreach ($routes as $route) {
			$router[] = $route;
		}

		/**
		 * User routes on second place
		 */
		foreach ($user_routes as $route) {
			$router[] = $route;
		}
	}
public function prepandRoutes ( IRouter $ router , array $ routes ) : void { if ( empty ( $ routes ) ) { return ; } if ( ! ( $ router instanceof \ Traversable ) || ! ( $ router instanceof \ ArrayAccess ) ) { throw new ApiRouteWrongRouterException ( sprintf ( 'ApiRoutesResolver can not add ApiRoutes to your router. Use for example %s instead' , RouteList :: class ) ) ; } $ user_routes = $ this -> findAndDestroyUserRoutes ( $ router ) ; /**
		 * Add ApiRoutes first
		 */ foreach ( $ routes as $ route ) { $ router [ ] = $ route ; } /**
		 * User routes on second place
		 */ foreach ( $ user_routes as $ route ) { $ router [ ] = $ route ; } }
Place REST API routes at the beginnig of all routes
Place REST API routes at the beginnig of all routes