Files
kiri-client/TSwooleClient.php
T

41 lines
806 B
PHP
Raw Normal View History

2022-01-09 13:54:34 +08:00
<?php
2022-01-10 11:39:56 +08:00
namespace Kiri;
2022-01-09 13:54:34 +08:00
use JetBrains\PhpStorm\Pure;
trait TSwooleClient
{
2022-01-11 14:46:08 +08:00
/**
* @return array
*/
#[Pure] private function settings(): array
{
$sslCert = $this->getSslCertFile();
$sslKey = $this->getSslKeyFile();
$sslCa = $this->getCa();
$params = [
2022-01-11 14:46:42 +08:00
'open_eof_check' => true,
'package_eof' => "\r\n\r\n"
2022-01-11 14:46:08 +08:00
];
if ($this->getConnectTimeout() > 0) {
$params['timeout'] = $this->getConnectTimeout();
}
if (empty($sslCert) || empty($sslKey) || empty($sslCa)) {
return $params;
}
$params['ssl_host_name'] = $this->getHost();
$params['ssl_cert_file'] = $this->getSslCertFile();
$params['ssl_key_file'] = $this->getSslKeyFile();
$params['ssl_verify_peer'] = TRUE;
$params['ssl_cafile'] = $sslCa;
return $params;
}
2022-01-09 13:54:34 +08:00
2022-01-10 11:39:56 +08:00
}