PHP 8.1.33
Preview: PhpInputStream.php Size: 1.80 KB
/home/jambtst2015/public_html/ida.com.ng/libraries/vendor/laminas/laminas-diactoros/src/PhpInputStream.php

<?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;
    }
}

Directory Contents

Dirs: 4 × Files: 21

Name Size Perms Modified Actions
Exception DIR
- drwxr-xr-x 2024-11-22 17:53:12
Edit Download
functions DIR
- drwxr-xr-x 2024-11-22 17:53:12
Edit Download
Request DIR
- drwxr-xr-x 2024-11-22 17:53:12
Edit Download
Response DIR
- drwxr-xr-x 2024-11-22 17:53:12
Edit Download
4.48 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
3.35 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.54 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
5.31 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
12.63 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
521 B lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.80 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
3.76 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
2.07 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
662 B lrw-r--r-- 2024-11-22 17:53:12
Edit Download
9.96 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
5.88 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
727 B lrw-r--r-- 2024-11-22 17:53:12
Edit Download
6.44 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
3.02 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
8.60 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.22 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
7.49 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
1.02 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
17.34 KB lrw-r--r-- 2024-11-22 17:53:12
Edit Download
621 B lrw-r--r-- 2024-11-22 17:53:12
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).