protected function getKey(string $key, bool $register = false): string
    {
        $lowercaseKey = strtolower($key);
        if (isset($this->keyMap[$lowercaseKey])) {
            $key = $this->keyMap[$lowercaseKey];
        } elseif ($register) {
            $this->keyMap[$lowercaseKey] = $key;
        }
        return $key;
    }