You are here

abstract class AbstractPipes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/process/Pipes/AbstractPipes.php \Symfony\Component\Process\Pipes\AbstractPipes

@author Romain Neutron <imprec@gmail.com>

@internal

Hierarchy

Expanded class hierarchy of AbstractPipes

File

vendor/symfony/process/Pipes/AbstractPipes.php, line 19

Namespace

Symfony\Component\Process\Pipes
View source
abstract class AbstractPipes implements PipesInterface {

  /** @var array */
  public $pipes = array();

  /** @var string */
  protected $inputBuffer = '';

  /** @var resource|null */
  protected $input;

  /** @var bool */
  private $blocked = true;

  /**
   * {@inheritdoc}
   */
  public function close() {
    foreach ($this->pipes as $pipe) {
      fclose($pipe);
    }
    $this->pipes = array();
  }

  /**
   * Returns true if a system call has been interrupted.
   *
   * @return bool
   */
  protected function hasSystemCallBeenInterrupted() {
    $lastError = error_get_last();

    // stream_select returns false when the `select` system call is interrupted by an incoming signal
    return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  }

  /**
   * Unblocks streams.
   */
  protected function unblock() {
    if (!$this->blocked) {
      return;
    }
    foreach ($this->pipes as $pipe) {
      stream_set_blocking($pipe, 0);
    }
    if (null !== $this->input) {
      stream_set_blocking($this->input, 0);
    }
    $this->blocked = false;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractPipes::$blocked private property @var bool
AbstractPipes::$input protected property @var resource|null
AbstractPipes::$inputBuffer protected property @var string
AbstractPipes::$pipes public property @var array
AbstractPipes::close public function Closes file handles and pipes. Overrides PipesInterface::close 1
AbstractPipes::hasSystemCallBeenInterrupted protected function Returns true if a system call has been interrupted.
AbstractPipes::unblock protected function Unblocks streams.
PipesInterface::areOpen public function Returns if the current state has open file handles or pipes. 2
PipesInterface::CHUNK_SIZE constant
PipesInterface::getDescriptors public function Returns an array of descriptors for the use of proc_open. 2
PipesInterface::getFiles public function Returns an array of filenames indexed by their related stream in case these pipes use temporary files. 2
PipesInterface::readAndWrite public function Reads data in file handles and pipes. 2