Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c260ac6df4 | |||
| 7479bed4e4 | |||
| 39394f76d5 |
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Server\Contract;
|
||||
|
||||
use Swoole\Http\Response;
|
||||
|
||||
interface OnDownloadInterface
|
||||
{
|
||||
|
||||
public function dispatch(Response $response);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Server\Events;
|
||||
|
||||
class OnServerBeforeStart
|
||||
{
|
||||
|
||||
}
|
||||
+7
-4
@@ -7,9 +7,10 @@ namespace Server;
|
||||
use Annotation\Inject;
|
||||
use Exception;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Events\EventProvider;
|
||||
use Kiri\Events\EventDispatch;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
use Server\Events\OnServerBeforeStart;
|
||||
use Swoole\Coroutine;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
@@ -29,10 +30,10 @@ class ServerCommand extends Command
|
||||
|
||||
|
||||
/**
|
||||
* @var EventProvider
|
||||
* @var EventDispatch
|
||||
*/
|
||||
#[Inject(EventProvider::class)]
|
||||
public EventProvider $eventProvider;
|
||||
#[Inject(EventDispatch::class)]
|
||||
public EventDispatch $eventProvider;
|
||||
|
||||
|
||||
/**
|
||||
@@ -105,6 +106,8 @@ class ServerCommand extends Command
|
||||
|
||||
Kiri::app()->getRouter()->read_files();
|
||||
|
||||
$this->eventProvider->dispatch(new OnServerBeforeStart());
|
||||
|
||||
$manager->start();
|
||||
|
||||
return 1;
|
||||
|
||||
+9
-5
@@ -5,10 +5,12 @@ namespace Server;
|
||||
use Annotation\Inject;
|
||||
use Exception;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Di\ContainerInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Kiri\Error\Logger;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use ReflectionException;
|
||||
use Server\Abstracts\BaseProcess;
|
||||
use Server\Contract\OnCloseInterface;
|
||||
@@ -334,10 +336,12 @@ class ServerManager
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $events
|
||||
* @param Server|Port $server
|
||||
*/
|
||||
/**
|
||||
* @param array $events
|
||||
* @param Server|Port $server
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
private function addServiceEvents(array $events, Server|Port $server)
|
||||
{
|
||||
foreach ($events as $name => $event) {
|
||||
|
||||
Reference in New Issue
Block a user