MediaWiki REL1_39
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
39 private $callback;
40
42 protected $stream;
43
44 public function __construct( callable $cb ) {
45 $this->stream = Utils::streamFor();
46 $this->callback = $cb;
47 }
48
49 public function write( $string ) {
50 return call_user_func( $this->callback, $this, $string );
51 }
52}
StreamInterface $stream
__construct(callable $cb)