public static function check(Identifiable $element)
    {
        $elementId = $element->getId();

        if (!$elementId) {
            $element->setId(new static());
            return $element->getId();
        }

        $dangerousCharacters = array(' ', '|', PHP_EOL);
        $danger              = false;
        foreach ($dangerousCharacters as $dangerousCharacter) {
            if (stripos($elementId, $dangerousCharacter) !== false) {
                $danger = true;
                break;
            }
        }

        if ($danger) {
            trigger_error("Don't use special characters in IDs, they might cause problems! Stripping them for you...");
            $elementId = str_ireplace($dangerousCharacters, '', $elementId);
            $element->setId($elementId);
        }

        return $element->getId();
    }