kernal clean-up

This commit is contained in:
root
2025-12-21 19:33:47 -05:00
parent 3ffabfe3a3
commit 658a319ded
22 changed files with 832 additions and 334 deletions

View File

@@ -3,9 +3,10 @@
namespace KTXC\Module;
use Exception;
use DI\Attribute\Inject;
use KTXC\Module\Store\ModuleStore;
use KTXC\Module\Store\ModuleEntry;
use KTXC\Server;
use Psr\Container\ContainerInterface;
use KTXF\Module\ModuleInstanceInterface;
use Psr\Log\LoggerInterface;
use ReflectionClass;
@@ -17,10 +18,12 @@ class ModuleManager
public function __construct(
private readonly ModuleStore $repository,
private readonly LoggerInterface $logger
private readonly LoggerInterface $logger,
private readonly ContainerInterface $container,
#[Inject('rootDir')] private readonly string $rootDir
) {
// Initialize server root path
$this->serverRoot = Server::runtimeRootLocation();
$this->serverRoot = $rootDir;
}
/**
@@ -393,7 +396,6 @@ class ModuleManager
}
// For modules with dependencies, try to resolve them from the container
$container = Server::runtimeContainer();
$parameters = $constructor->getParameters();
$args = [];
@@ -403,8 +405,8 @@ class ModuleManager
$typeName = $type->getName();
// Try to get service from container
if ($container->has($typeName)) {
$args[] = $container->get($typeName);
if ($this->container->has($typeName)) {
$args[] = $this->container->get($typeName);
} elseif ($parameter->isDefaultValueAvailable()) {
$args[] = $parameter->getDefaultValue();
} else {