Revert "改名"

This reverts commit fdf58326
This commit is contained in:
2022-01-07 18:38:45 +08:00
parent 9c28ce91ae
commit 89807fe548
+19 -2
View File
@@ -287,9 +287,12 @@ class ServerManager extends Component
$this->server = new $match($host, $port, SWOOLE_PROCESS, $mode);
$this->server->set(array_merge(Config::get('server.settings', []), $settings['settings']));
$string = "| 名称 \t| 值 \t|\n";
$maxLength = $this->getMaxKeyLength($this->server->setting);
$string = sprintf("| %s \t| %s \t|\n", str_pad('名称', $maxLength - strlen('名称')), '值');
foreach ($this->server->setting as $key => $value) {
$string .= sprintf("|%s \t| %s \t|\n", $key, $value);
$string .= sprintf("| %s \t| %s \t|\n", str_pad($key, $maxLength - strlen($key)), $value);
}
echo $string;
@@ -301,6 +304,20 @@ class ServerManager extends Component
}
private function getMaxKeyLength($array)
{
$length = 0;
foreach ($array as $key => $val) {
if (strlen($key) > $length) {
$length = strlen($key);
}
}
return $length;
}
/**
* @param array $settings
* @throws ContainerExceptionInterface