Merge pull request #54303 from nextcloud/jtr-oc-appframework-app-cleanup

pull/52671/merge
Benjamin Gaussorgues 2025-08-08 10:41:51 +07:00 committed by GitHub
commit 8783679a49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 23 deletions

@ -71,7 +71,6 @@ class App {
return null; return null;
} }
/** /**
* Shortcut for calling a controller method and printing the result * Shortcut for calling a controller method and printing the result
* *
@ -82,7 +81,12 @@ class App {
* @param array $urlParams list of URL parameters (optional) * @param array $urlParams list of URL parameters (optional)
* @throws HintException * @throws HintException
*/ */
public static function main(string $controllerName, string $methodName, DIContainer $container, ?array $urlParams = null) { public static function main(
string $controllerName,
string $methodName,
DIContainer $container,
?array $urlParams = null,
): void {
/** @var IProfiler $profiler */ /** @var IProfiler $profiler */
$profiler = $container->get(IProfiler::class); $profiler = $container->get(IProfiler::class);
$eventLogger = $container->get(IEventLogger::class); $eventLogger = $container->get(IEventLogger::class);
@ -210,25 +214,4 @@ class App {
} }
} }
} }
/**
* Shortcut for calling a controller method and printing the result.
* Similar to App:main except that no headers will be sent.
*
* @param string $controllerName the name of the controller under which it is
* stored in the DI container
* @param string $methodName the method that you want to call
* @param array $urlParams an array with variables extracted from the routes
* @param DIContainer $container an instance of a pimple container.
*/
public static function part(string $controllerName, string $methodName, array $urlParams,
DIContainer $container) {
$container['urlParams'] = $urlParams;
$controller = $container[$controllerName];
$dispatcher = $container['Dispatcher'];
[, , $output] = $dispatcher->dispatch($controller, $methodName);
return $output;
}
} }