class StreamCapturer

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/StreamCapturer.php \Drupal\Tests\StreamCapturer
  2. 10 core/tests/Drupal/Tests/StreamCapturer.php \Drupal\Tests\StreamCapturer

Captures output to a stream and stores it for retrieval.

Hierarchy

  • class \Drupal\Tests\StreamCapturer implements \Drupal\Tests\php_user_filter

Expanded class hierarchy of StreamCapturer

File

core/tests/Drupal/Tests/StreamCapturer.php, line 12

Namespace

Drupal\Tests
View source
class StreamCapturer extends \php_user_filter {
  
  /**
   * The cache data.
   *
   * @var string
   */
  public static $cache = '';
  public function filter($in, $out, &$consumed, $closing) : int {
    while ($bucket = stream_bucket_make_writeable($in)) {
      self::$cache .= $bucket->data;
      $consumed += $bucket->datalen;
      stream_bucket_append($out, $bucket);
    }
    return PSFS_FEED_ME;
  }

}

Members

Title Sort descending Modifiers Object type Summary
StreamCapturer::$cache public static property The cache data.
StreamCapturer::filter public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.