N°7629 Deprecate utils::GetClassesForInterface in favor of InterfaceDiscovery::FindItopClasses

Improve caching strategy and robustness
This commit is contained in:
Romain Quetiez
2024-07-06 12:08:51 +02:00
parent 147aad9221
commit baf85e7a80
19 changed files with 845 additions and 112 deletions

View File

@@ -6,6 +6,8 @@
namespace Combodo\iTop\Service\Router;
use Combodo\iTop\Controller\iController;
use Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery;
use Combodo\iTop\Service\Router\Exception\RouteNotFoundException;
use ReflectionClass;
use ReflectionMethod;
@@ -174,7 +176,7 @@ class Router
// If no cache, force to re-scan for routes
if (count($aRoutes) === 0) {
foreach (utils::GetClassesForInterface('Combodo\iTop\Controller\iController', '', ['[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]']) as $sControllerFQCN) {
foreach (InterfaceDiscovery::GetInstance()->FindItopClasses(iController::class) as $sControllerFQCN) {
$sRouteNamespace = $sControllerFQCN::ROUTE_NAMESPACE;
// Ignore controller with no namespace
if (is_null($sRouteNamespace)) {