public function setAllowedTags($allowedTags)
    {
        if (!is_array($allowedTags)) {
            $allowedTags = array($allowedTags);
        }

        foreach ($allowedTags as $index => $element) {

            // If the tag was provided without attributes
            if (is_int($index) && is_string($element)) {
                // Canonicalize the tag name
                $tagName = strtolower($element);
                // Store the tag as allowed with no attributes
                $this->allowedTags[$tagName] = [];
            }

            // Otherwise, if a tag was provided with attributes
            else if (is_string($index) && (is_array($element) || is_string($element))) {

                // Canonicalize the tag name
                $tagName = strtolower($index);
                // Canonicalize the attributes
                if (is_string($element)) {
                    $element = [$element];
                }

                // Store the tag as allowed with the provided attributes
                $this->allowedTags[$tagName] = [];
                foreach ($element as $attribute) {
                    if (is_string($attribute)) {
                        // Canonicalize the attribute name
                        $attributeName = strtolower($attribute);
                        $this->allowedTags[$tagName][$attributeName] = null;
                    }
                }

            }
        }

        return $this;
    }