refactor(App): Remove registerRoutes method

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2024-01-10 11:08:44 +01:00 committed by Ferdinand Thiessen
parent 07fa9b9311
commit db70ff6488
No known key found for this signature in database
GPG key ID: 45FAE7268762B400
2 changed files with 1 additions and 33 deletions

View file

@ -169,7 +169,7 @@ class Router implements IRouter {
$this->loadedApps['core'] = true;
$this->useCollection('root');
$this->setupRoutes($this->getAttributeRoutes('core'), 'core');
require __DIR__ . '/../../../core/routes.php';
$this->requireRouteFile(__DIR__ . '/../../../core/routes.php', 'core');
// Also add the OCS collection
$collection = $this->getCollection('root.ocs');

View file

@ -9,10 +9,7 @@ declare(strict_types=1);
*/
namespace OCP\AppFramework;
use OC\AppFramework\Routing\RouteConfig;
use OC\Route\Router;
use OC\ServerContainer;
use OCP\Route\IRouter;
use Psr\Log\LoggerInterface;
/**
@ -96,35 +93,6 @@ class App {
return $this->container;
}
/**
* This function is to be called to create single routes and restful routes based on the given $routes array.
*
* Example code in routes.php of tasks app (it will register two restful resources):
* $routes = array(
* 'resources' => array(
* 'lists' => array('url' => '/tasklists'),
* 'tasks' => array('url' => '/tasklists/{listId}/tasks')
* )
* );
*
* $a = new TasksApp();
* $a->registerRoutes($this, $routes);
*
* @param \OCP\Route\IRouter $router
* @param array $routes
* @since 6.0.0
* @suppress PhanAccessMethodInternal
* @deprecated 20.0.0 Just return an array from your routes.php
*/
public function registerRoutes(IRouter $router, array $routes) {
if (!($router instanceof Router)) {
throw new \RuntimeException('Can only setup routes with real router');
}
$routeConfig = new RouteConfig($this->container, $router, $routes);
$routeConfig->register();
}
/**
* This function is called by the routing component to fire up the frameworks dispatch mechanism.
*