contentAttributes = new AttributeList; if (isset($options)) { foreach ($options as $optionName => $optionValue) { $this->__set($optionName, $optionValue); } } } /** * {@inheritdoc} */ public function asConfig() { $config = ConfigHelper::toArray(get_object_vars($this)); if (!$this->forceLookahead) { unset($config['forceLookahead']); } return $config; } /** * Normalize the name of a BBCode * * Follows the same rules as tag names with one exception: "*" is kept for compatibility with * other BBCode engines * * @param string $bbcodeName Original name * @return string Normalized name */ public static function normalizeName($bbcodeName) { if ($bbcodeName === '*') { return '*'; } if (strpos($bbcodeName, ':') !== false || !TagName::isValid($bbcodeName)) { throw new InvalidArgumentException("Invalid BBCode name '" . $bbcodeName . "'"); } return TagName::normalize($bbcodeName); } /** * Set the default attribute name for this BBCode * * @param string $attrName */ public function setDefaultAttribute($attrName) { $this->defaultAttribute = AttributeName::normalize($attrName); } /** * Set the tag name that represents this BBCode in the intermediate representation * * @param string $tagName */ public function setTagName($tagName) { $this->tagName = TagName::normalize($tagName); } }