![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/ |
<?php namespace PhpAmqpLib\Wire; use PhpAmqpLib\Exception\AMQPDataReadException; class AMQPBufferReader extends AMQPReader { /** * @var string */ private $buffer; /** * @var int */ private $length; public function __construct(string $buffer) { $this->buffer = $buffer; $this->length = mb_strlen($buffer, 'ASCII'); } public function close(): void { } /** * Resets the object from the injected param * * Used to not need to create a new AMQPBufferReader instance every time. * when we can just pass a string and reset the object state. * NOTE: since we are working with strings we don't need to pass an AbstractIO * or a timeout. * * @param string $str */ public function reset(string $str): void { $this->buffer = $str; $this->length = mb_strlen($this->buffer, 'ASCII'); $this->offset = 0; $this->resetCounters(); } protected function rawread(int $n): string { if ($this->length < $n) { throw new AMQPDataReadException(sprintf( 'Error reading data. Requested %s bytes while string buffer has only %s', $n, $this->length )); } $res = mb_substr($this->buffer, 0, $n, 'ASCII'); $this->buffer = mb_substr($this->buffer, $n, null, 'ASCII'); $this->length -= $n; $this->offset += $n; return $res; } }