protected function normalizeKey(&$key)
    {
        $key = (string)$key;

        if ($key === '') {
            throw new InvalidArgumentException("An empty key isn't allowed");
        } elseif (($p = $this->getOptions()->getKeyPattern()) && !preg_match($p, $key)) {
            throw new InvalidArgumentException(
                "The key '{$key}' doesn't match against pattern '{$p}'"
            );
        }
    }