protected function setKey($key)
    {
        // If a handler switches key, we need to decrement the counter for the old
        // key, and increment the counter for the new key.
        $this->removeKey();

        // Set the new key, and increment the counter appropriately.
        $this->key = $key;
        if (isset($key)) {
            static::$keys[$key] = isset(static::$keys[$key]) ? static::$keys[$key] + 1 : 1;
        }
    }