Skip to content

Commit

Permalink
Rename services
Browse files Browse the repository at this point in the history
  • Loading branch information
luzrain committed Mar 22, 2024
1 parent 4b45f15 commit 7d82a57
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Http/HttpRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private function handle(ServerRequestInterface $request): ResponseInterface
$symfonyResponse = $this->kernel->handle($symfonyRequest);

/** @var WorkerProcess $worker */
$worker = $this->kernel->getContainer()->get('phprunner.worker');
$worker = $this->kernel->getContainer()->get('phpstreamserver.worker');

if ($this->kernel instanceof TerminableInterface) {
$worker->getEventLoop()->defer(function () use ($symfonyRequest, $symfonyResponse): void {
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/WorkerConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public function configure(WorkerProcess $worker): void
$worker->setLogger($this->logger);
$worker->setErrorHandler($errorHandlerClosure);

$this->kernel->getContainer()->set('phprunner.worker', $worker);
$this->kernel->getContainer()->set('phpstreamserver.worker', $worker);
}
}
4 changes: 2 additions & 2 deletions src/Worker/HttpServerWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ private function onStart(): void
{
$kernel = $this->kernelFactory->createKernel();
$kernel->boot();
$kernel->getContainer()->get('phprunner.worker_configurator')->configure($this);
$kernel->getContainer()->get('phpstreamserver.worker_configurator')->configure($this);

/** @var \Closure $httpHandler */
$httpHandler = $kernel->getContainer()->get('phprunner.http_request_handler');
$httpHandler = $kernel->getContainer()->get('phpstreamserver.http_request_handler');

/** @var EventDispatcherInterface $eventDispatcher */
$eventDispatcher = $kernel->getContainer()->get('event_dispatcher');
Expand Down
4 changes: 2 additions & 2 deletions src/Worker/ProcessWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ private function onStart(): void
{
$kernel = $this->kernelFactory->createKernel();
$kernel->boot();
$kernel->getContainer()->get('phprunner.worker_configurator')->configure($this);
$kernel->getContainer()->get('phpstreamserver.worker_configurator')->configure($this);
/** @var Application $application */
$application = $kernel->getContainer()->get('phprunner.application');
$application = $kernel->getContainer()->get('phpstreamserver.application');

/** @psalm-suppress RiskyTruthyFalsyComparison */
if ($application->has(\strstr($this->command, ' ', true) ?: $this->command)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Worker/SchedulerWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private function onStart(): void
{
$this->kernel = $this->kernelFactory->createKernel();
$this->kernel->boot();
$this->kernel->getContainer()->get('phprunner.worker_configurator')->configure($this);
$this->kernel->getContainer()->get('phpstreamserver.worker_configurator')->configure($this);

/**
* @var string|null $name
Expand Down Expand Up @@ -109,7 +109,7 @@ private function runCommand(TriggerInterface $trigger, string $name, string $com
}

/** @var Application $application */
$application = $this->kernel->getContainer()->get('phprunner.application');
$application = $this->kernel->getContainer()->get('phpstreamserver.application');

/** @psalm-suppress RiskyTruthyFalsyComparison */
if ($application->has(\strstr($command, ' ', true) ?: $command)) {
Expand Down
18 changes: 9 additions & 9 deletions src/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

return static function (array $config, ContainerBuilder $container) {
$container
->register('phprunner.config_loader', ConfigLoader::class)
->register('phpstreamserver.config_loader', ConfigLoader::class)
->addMethodCall('setConfig', [$config])
->addTag('kernel.cache_warmer')
->setArguments([
Expand All @@ -29,19 +29,19 @@
;

$container
->register('phprunner.http_request_handler', HttpRequestHandler::class)
->register('phpstreamserver.http_request_handler', HttpRequestHandler::class)
->setArguments([new Reference('kernel')])
->setPublic(true)
;

$container
->register('phprunner.worker_configurator', WorkerConfigurator::class)
->register('phpstreamserver.worker_configurator', WorkerConfigurator::class)
->setArguments([new Reference('kernel'), new Reference('logger')])
->setPublic(true)
;

$container
->register('phprunner.application', Application::class)
->register('phpstreamserver.application', Application::class)
->addMethodCall('setAutoExit', [false])
->setArguments([new Reference('kernel')])
->setShared(false)
Expand All @@ -50,7 +50,7 @@

if ($config['reload_strategy']['on_exception']['active']) {
$container
->register('phprunner.on_exception_reload_strategy', OnException::class)
->register('phpstreamserver.on_exception_reload_strategy', OnException::class)
->addTag('kernel.event_listener', [
'event' => HttpServerStartEvent::class,
'method' => 'onServerStart',
Expand All @@ -68,7 +68,7 @@

if ($config['reload_strategy']['on_each_request']['active']) {
$container
->register('phprunner.on_each_request_reload_strategy', OnEachRequest::class)
->register('phpstreamserver.on_each_request_reload_strategy', OnEachRequest::class)
->addTag('kernel.event_listener', [
'event' => HttpServerStartEvent::class,
'method' => 'onServerStart',
Expand All @@ -78,7 +78,7 @@

if ($config['reload_strategy']['on_ttl_limit']['active']) {
$container
->register('phprunner.on_ttl_limit_reload_strategy', OnTTLLimit::class)
->register('phpstreamserver.on_ttl_limit_reload_strategy', OnTTLLimit::class)
->addTag('kernel.event_listener', [
'event' => HttpServerStartEvent::class,
'method' => 'onServerStart',
Expand All @@ -91,7 +91,7 @@

if ($config['reload_strategy']['on_requests_limit']['active']) {
$container
->register('phprunner.on_requests_limit_reload_strategy', OnRequestsLimit::class)
->register('phpstreamserver.on_requests_limit_reload_strategy', OnRequestsLimit::class)
->addTag('kernel.event_listener', [
'event' => HttpServerStartEvent::class,
'method' => 'onServerStart',
Expand All @@ -105,7 +105,7 @@

if ($config['reload_strategy']['on_memory_limit']['active']) {
$container
->register('phprunner.on_on_memory_limit_reload_strategy', OnMemoryLimit::class)
->register('phpstreamserver.on_on_memory_limit_reload_strategy', OnMemoryLimit::class)
->addTag('kernel.event_listener', [
'event' => HttpServerStartEvent::class,
'method' => 'onServerStart',
Expand Down
6 changes: 3 additions & 3 deletions tests/ServicesAutowiringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function testServiceAutowiring(): void
{
$container = self::getContainer();

$this->assertInstanceOf(HttpRequestHandler::class, $container->get('phprunner.http_request_handler'));
$this->assertInstanceOf(WorkerConfigurator::class, $container->get('phprunner.worker_configurator'));
$this->assertInstanceOf(Application::class, $container->get('phprunner.application'));
$this->assertInstanceOf(HttpRequestHandler::class, $container->get('phpstreamserver.http_request_handler'));
$this->assertInstanceOf(WorkerConfigurator::class, $container->get('phpstreamserver.worker_configurator'));
$this->assertInstanceOf(Application::class, $container->get('phpstreamserver.application'));
}
}

0 comments on commit 7d82a57

Please sign in to comment.