X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/libs/DeferredStringifier.php diff --git a/includes/libs/DeferredStringifier.php b/includes/libs/DeferredStringifier.php new file mode 100644 index 00000000..a6fd11a4 --- /dev/null +++ b/includes/libs/DeferredStringifier.php @@ -0,0 +1,57 @@ +params = func_get_args(); + array_shift( $this->params ); + $this->callback = $callback; + } + + /** + * Get the string generated from the callback + * + * @return string + */ + public function __toString() { + if ( $this->result === null ) { + $this->result = call_user_func_array( $this->callback, $this->params ); + } + return $this->result; + } +}