MediaWiki REL1_37
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
41 public function __construct( callable $cb ) {
42 $this->stream = Utils::streamFor();
43 $this->callback = $cb;
44 }
45
46 public function write( $string ) {
47 return call_user_func( $this->callback, $this, $string );
48 }
49}
__construct(callable $cb)