update patch 1

This commit is contained in:
fiqhpratama
2024-12-02 01:18:34 +07:00
parent 453d9bb470
commit 25026b0a85
3380 changed files with 103529 additions and 363623 deletions
@@ -37,9 +37,9 @@ abstract class AbstractStream
public function write(string $bytes, bool $debug = true): void
{
if ($debug) {
$timestamp = date('c');
$timestamp = (new \DateTimeImmutable())->format('Y-m-d\TH:i:s.up');
foreach (explode("\n", trim($bytes)) as $line) {
$this->debug .= sprintf("[%s] > %s\n", $timestamp, $line);
$this->debug .= \sprintf("[%s] > %s\n", $timestamp, $line);
}
}
@@ -83,17 +83,17 @@ abstract class AbstractStream
if ('' === $line || false === $line) {
$metas = stream_get_meta_data($this->out);
if ($metas['timed_out']) {
throw new TransportException(sprintf('Connection to "%s" timed out.', $this->getReadConnectionDescription()));
throw new TransportException(\sprintf('Connection to "%s" timed out.', $this->getReadConnectionDescription()));
}
if ($metas['eof']) {
throw new TransportException(sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription()));
throw new TransportException(\sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription()));
}
if (false === $line) {
throw new TransportException(sprintf('Unable to read from connection to "%s": ', $this->getReadConnectionDescription()).error_get_last()['message']);
throw new TransportException(\sprintf('Unable to read from connection to "%s": ', $this->getReadConnectionDescription()).error_get_last()['message']);
}
}
$this->debug .= sprintf('[%s] < %s', date('c'), $line);
$this->debug .= \sprintf('[%s] < %s', (new \DateTimeImmutable())->format('Y-m-d\TH:i:s.up'), $line);
return $line;
}
@@ -151,7 +151,7 @@ final class SocketStream extends AbstractStream
$timeout = $this->getTimeout();
set_error_handler(function ($type, $msg) {
throw new TransportException(sprintf('Connection could not be established with host "%s": ', $this->url).$msg);
throw new TransportException(\sprintf('Connection could not be established with host "%s": ', $this->url).$msg);
});
try {
$this->stream = stream_socket_client($this->url, $errno, $errstr, $timeout, \STREAM_CLIENT_CONNECT, $streamContext);