Files
kiri-core/http-server/Abstracts/Server.php
T

57 lines
792 B
PHP
Raw Normal View History

2021-07-19 19:04:13 +08:00
<?php
namespace Server\Abstracts;
2021-08-24 19:11:14 +08:00
use Annotation\Inject;
2021-07-19 19:04:13 +08:00
use Exception;
2021-08-11 01:04:57 +08:00
use Kiri\Abstracts\Config;
2021-08-24 19:11:14 +08:00
use Kiri\Abstracts\Logger;
2021-08-11 01:04:57 +08:00
use Kiri\Exception\ConfigException;
use Kiri\Kiri;
2021-08-24 19:11:14 +08:00
use Psr\Log\LoggerInterface;
2021-07-19 19:04:13 +08:00
/**
* Class Server
* @package Server\Abstracts
*/
abstract class Server
{
2021-08-24 19:11:14 +08:00
/**
* @var LoggerInterface
*/
#[Inject(LoggerInterface::class)]
public LoggerInterface $logger;
2021-08-12 14:08:40 +08:00
/**
* @param $prefix
* @throws ConfigException
*/
protected function setProcessName($prefix)
{
if (Kiri::getPlatform()->isMac()) {
return;
}
$name = Config::get('id', 'system-service');
if (!empty($prefix)) {
$name .= '.' . $prefix;
}
swoole_set_process_name($name);
}
2021-07-21 19:05:11 +08:00
/**
* Server constructor.
* @throws Exception
*/
2021-08-12 14:08:40 +08:00
public function __construct()
2021-07-19 19:04:13 +08:00
{
}
}