MediaWiki  master
DeferredStringifier.php
Go to the documentation of this file.
1 <?php
29  private $callback;
30 
32  private $params;
33 
35  private $result;
36 
41  public function __construct( $callback, ...$params ) {
42  $this->callback = $callback;
43  $this->params = $params;
44  }
45 
51  public function __toString() {
52  if ( $this->result === null ) {
53  $this->result = call_user_func_array( $this->callback, $this->params );
54  }
55  return $this->result;
56  }
57 }
__toString()
Get the string generated from the callback.
__construct( $callback,... $params)
callable $callback
Callback used for result string generation.