diff --git a/src/ChrisKonnertz/BBCode/BBCode.php b/src/ChrisKonnertz/BBCode/BBCode.php index 7d302d9..9712796 100644 --- a/src/ChrisKonnertz/BBCode/BBCode.php +++ b/src/ChrisKonnertz/BBCode/BBCode.php @@ -16,7 +16,8 @@ class BBCode { /** - * Constants with the names of the built-in tags + * Constants with the names of the built-in default tags + * Call getDefaultTagNames() to get them as an array. */ const TAG_NAME_B = 'b'; const TAG_NAME_I = 'i'; @@ -39,32 +40,6 @@ class BBCode const TAG_NAME_RIGHT = 'right'; const TAG_NAME_SPOILER = 'spoiler'; - /** - * Array with the names of all tags - */ - const TAG_NAMES = [ - self::TAG_NAME_B, - self::TAG_NAME_I, - self::TAG_NAME_S, - self::TAG_NAME_U, - self::TAG_NAME_CODE, - self::TAG_NAME_EMAIL, - self::TAG_NAME_URL, - self::TAG_NAME_IMG, - self::TAG_NAME_LIST, - self::TAG_NAME_LI_STAR, - self::TAG_NAME_LI, - self::TAG_NAME_QUOTE, - self::TAG_NAME_YOUTUBE, - self::TAG_NAME_FONT, - self::TAG_NAME_SIZE, - self::TAG_NAME_COLOR, - self::TAG_NAME_LEFT, - self::TAG_NAME_CENTER, - self::TAG_NAME_RIGHT, - self::TAG_NAME_SPOILER, - ]; - /** * The text with BBCodes * @@ -644,6 +619,37 @@ public function setYouTubeHeight($youTubeHeight) $this->youTubeHeight = $youTubeHeight; } + /** + * Returns an array with the names of all default tags + * + * @return string[] + */ + public function getDefaultTagNames() + { + return [ + self::TAG_NAME_B, + self::TAG_NAME_I, + self::TAG_NAME_S, + self::TAG_NAME_U, + self::TAG_NAME_CODE, + self::TAG_NAME_EMAIL, + self::TAG_NAME_URL, + self::TAG_NAME_IMG, + self::TAG_NAME_LIST, + self::TAG_NAME_LI_STAR, + self::TAG_NAME_LI, + self::TAG_NAME_QUOTE, + self::TAG_NAME_YOUTUBE, + self::TAG_NAME_FONT, + self::TAG_NAME_SIZE, + self::TAG_NAME_COLOR, + self::TAG_NAME_LEFT, + self::TAG_NAME_CENTER, + self::TAG_NAME_RIGHT, + self::TAG_NAME_SPOILER, + ]; + } + /** * Returns true if $haystack ends with $needle *