MediaWiki  1.34.0
MWCallbackStream.php
Go to the documentation of this file.
1 <?php
21 use Psr\Http\Message\StreamInterface;
22 use GuzzleHttp\Psr7\StreamDecoratorTrait;
23 
34 class MWCallbackStream implements StreamInterface {
35  use StreamDecoratorTrait;
36 
37  private $callback;
38 
39  public function __construct( callable $cb ) {
40  $this->stream = GuzzleHttp\Psr7\stream_for();
41  $this->callback = $cb;
42  }
43 
44  public function write( $string ) {
45  return call_user_func( $this->callback, $this, $string );
46  }
47 }
MWCallbackStream\__construct
__construct(callable $cb)
Definition: MWCallbackStream.php:39
MWCallbackStream\write
write( $string)
Definition: MWCallbackStream.php:44
MWCallbackStream\$callback
$callback
Definition: MWCallbackStream.php:37
MWCallbackStream
Definition: MWCallbackStream.php:34