public function setAllowedAttributes($allowedAttribs)
    {
        if (!is_array($allowedAttribs)) {
            $allowedAttribs = [$allowedAttribs];
        }

        // Store each attribute as allowed.
        foreach ($allowedAttribs as $attribute) {
            if (is_string($attribute)) {
                // Canonicalize the attribute name.
                $attributeName = strtolower($attribute);
                $this->allowedAttributes[$attributeName] = null;
            }
        }

        return $this;
    }