From 790e3325028afe420d0ee01c1cba6fd0149ad054 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 5 Aug 2020 15:31:29 +0200 Subject: [PATCH] Add type-safe wrapper around MD_STD --- MD_STD.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/MD_STD.php b/MD_STD.php index 77a14dd..2bb1f55 100644 --- a/MD_STD.php +++ b/MD_STD.php @@ -67,6 +67,20 @@ class MD_STD { } + /** + * Type safe wrapper around ob_get_clean(): Gets the current buffer + * contents and delete current output buffer. + * + * @return string + */ + public static function ob_get_clean():string { + + $output = ob_get_clean(); + if ($output === false) throw new MDOutputBufferNotStarted("Output buffer was not started"); + return $output; + + } + /** * Function checking if a string starts with another. *