Files
kiri-core/http-server/Abstracts/Server.php
T
2021-08-24 19:11:14 +08:00

57 lines
792 B
PHP

<?php
namespace Server\Abstracts;
use Annotation\Inject;
use Exception;
use Kiri\Abstracts\Config;
use Kiri\Abstracts\Logger;
use Kiri\Exception\ConfigException;
use Kiri\Kiri;
use Psr\Log\LoggerInterface;
/**
* Class Server
* @package Server\Abstracts
*/
abstract class Server
{
/**
* @var LoggerInterface
*/
#[Inject(LoggerInterface::class)]
public LoggerInterface $logger;
/**
* @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);
}
/**
* Server constructor.
* @throws Exception
*/
public function __construct()
{
}
}