MediaWiki REL1_31
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 /*...*/ ) {
42 $this->params = func_get_args();
43 array_shift( $this->params );
44 $this->callback = $callback;
45 }
46
52 public function __toString() {
53 if ( $this->result === null ) {
54 $this->result = call_user_func_array( $this->callback, $this->params );
55 }
56 return $this->result;
57 }
58}
callable $callback
Callback used for result string generation.
__toString()
Get the string generated from the callback.