*/ final class UpgradedSocket implements Socket, ResourceStream, \IteratorAggregate { use ForbidCloning; use ForbidSerialization; use ReadableStreamIteratorAggregate; private ?string $buffer; /** * @param string $buffer Remaining buffer previously read from the socket. */ public function __construct( private readonly Socket $socket, string $buffer, ) { $this->buffer = $buffer !== '' ? $buffer : null; } public function read(?Cancellation $cancellation = null, ?int $limit = null): ?string { if ($this->buffer !== null) { if ($limit !== null && $limit < \strlen($this->buffer)) { $buffer = \substr($this->buffer, 0, $limit); $this->buffer = \substr($this->buffer, $limit); return $buffer; } $buffer = $this->buffer; $this->buffer = null; return $buffer; } return $this->socket->read($cancellation); } public function close(): void { $this->socket->close(); } public function __destruct() { $this->close(); } public function write(string $bytes): void { $this->socket->write($bytes); } public function end(): void { $this->socket->end(); } public function reference(): void { if ($this->socket instanceof ResourceStream) { $this->socket->reference(); } } public function unreference(): void { if ($this->socket instanceof ResourceStream) { $this->socket->unreference(); } } public function isClosed(): bool { return $this->socket->isClosed(); } public function onClose(\Closure $onClose): void { $this->socket->onClose($onClose); } public function getLocalAddress(): SocketAddress { return $this->socket->getLocalAddress(); } public function getRemoteAddress(): SocketAddress { return $this->socket->getRemoteAddress(); } public function setupTls(?Cancellation $cancellation = null): void { $this->socket->setupTls($cancellation); } public function shutdownTls(?Cancellation $cancellation = null): void { $this->socket->shutdownTls(); } public function isTlsConfigurationAvailable(): bool { return $this->socket->isTlsConfigurationAvailable(); } public function getTlsState(): TlsState { return $this->socket->getTlsState(); } public function getTlsInfo(): ?TlsInfo { return $this->socket->getTlsInfo(); } public function isReadable(): bool { return $this->socket->isReadable(); } public function isWritable(): bool { return $this->socket->isWritable(); } public function getResource() { return $this->socket instanceof ResourceStream ? $this->socket->getResource() : null; } } __halt_compiler();----SIGNATURE:----iXHEy3s0lmCCWSk2wxhbMaTKCSjOlwVfBbLJUmOj+HbsieoCM9PQKTW9p8pc9a/A2+n3xBOGctblhi/SG8+LCbdwh1mtwXz3HtKntxGIhQi7VkSN6LrXurTsUI3TRjql99rksQBkXIsqSvmteTqamTPOrt7wzJC0/lQwsKEL31QqUIEUCnY3a30Ek+A2pJ6G/zTU9g3sZ6K6oW3KJAkMaTq5mO6wNqPybVVZg27CJi80s8MbXpzLufq9h4pIx0nhxpcdxdIzLNwh+BrED4h6Jg/hLuKBreUyVbKViS0GqRGEZEYe2I2eM4PE7cUT4659o3wdiFpyS56oOllAxiQF7nc2/bff9dYLpj66p2dubHjN9S9RZZiiUyLsYh6if8tfONwkT0/6zG9KkcLFSQMG5F7TIKZGWqUo/Pa5ND6RMhSgrOutj9sDhujM4qAOhVxhz+LACEXVDvb3j2YaJR+OLgegDyJK4dpJ5dbATjPbwqzYDaxGEean8eip40XhZyDXQ3m0xNLWTr/fM8YTY8gDFwuIF7QfOVRFNfVhgtGvzpO7N/cnNHxihl70G9r/OIAKpfJ/zLuxRQId1A921kbA/CbJrbo9NBFzABK++galHx3rsRcF3fIW6hln37wWmR6GtKMnq59aU01Qvzb+SAptLBjFzgg6kTv7FI1ZMWuq3Fk=----ATTACHMENT:----NTg1MjAyMzM4OTc5NzcwIDI0NDU5MDUwODk1MTQwMTMgNjY5MjE4Nzk5NTc3OTY1MQ==