From eecd39e126fd0c164a0913c8fe8cca3b7f5e40e8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 13 Apr 2017 16:48:32 -0700 Subject: [PATCH] APIExplorer::formatDocBlock() - Make public. Normalize whitespace. This will make the function more useful for the hook inspector. --- CRM/Admin/Page/APIExplorer.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Admin/Page/APIExplorer.php b/CRM/Admin/Page/APIExplorer.php index 6097d5831a..c5bfa84a05 100644 --- a/CRM/Admin/Page/APIExplorer.php +++ b/CRM/Admin/Page/APIExplorer.php @@ -184,7 +184,12 @@ class CRM_Admin_Page_APIExplorer extends CRM_Core_Page { * @param string $text * @return string */ - private static function formatDocBlock($text) { + public static function formatDocBlock($text) { + // Normalize #leading spaces. + $lines = explode("\n", $text); + $lines = preg_replace('/^ +\*/', ' *', $lines); + $text = implode("\n", $lines); + // Get rid of comment stars $text = str_replace(array("\n * ", "\n *\n", "\n */\n", "/**\n"), array("\n", "\n\n", '', ''), $text); -- 2.25.1