mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Moved parseDocComment from PluginManager to Utils
This commit is contained in:
@ -622,4 +622,17 @@ class Utils{
|
||||
public static function cleanPath($path){
|
||||
return str_replace(["\\", ".php", "phar://", str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PATH), str_replace(["\\", "phar://"], ["/", ""], \pocketmine\PLUGIN_PATH)], ["/", "", "", "", ""], $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts one-line tags from the doc-comment
|
||||
*
|
||||
* @param string $docComment
|
||||
*
|
||||
* @return string[] an array of tagName => tag value. If the tag has no value, an empty string is used as the value.
|
||||
*/
|
||||
public static function parseDocComment(string $docComment) : array{
|
||||
preg_match_all('/^[\t ]*\* @([a-zA-Z]+)(?:[\t ]+(.+))?[\t ]*$/m', $docComment, $matches);
|
||||
|
||||
return array_combine($matches[1], array_map("trim", $matches[2]));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user