public function setKey($key)
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException(sprintf(
                'Key must be a string; received %s',
                (is_object($key) ? get_class($key) : gettype($key))
            ));
        }

        if (!preg_match_all('/^[A-Za-z0-9_]+$/', $key)) {
            throw new InvalidArgumentException(
                sprintf('Key "%s" is invalid: must be alphanumeric / underscore.', $key)
            );
        }

        $this->key = $key;
        return $this;
    }