MediaWiki 1.43.1
MWCallbackStream.php
Go to the documentation of this file.
1<?php
21use GuzzleHttp\Psr7\StreamDecoratorTrait;
22use GuzzleHttp\Psr7\Utils;
23use Psr\Http\Message\StreamInterface;
24
36class MWCallbackStream implements StreamInterface {
37 use StreamDecoratorTrait;
38
40 private $callback;
41
43 protected $stream;
44
45 public function __construct( callable $cb ) {
46 $this->stream = Utils::streamFor();
47 $this->callback = $cb;
48 }
49
50 public function write( $string ) {
51 return call_user_func( $this->callback, $this, $string );
52 }
53}
StreamInterface $stream
__construct(callable $cb)