protected function validateKey($key) { if (empty($key) || !preg_match('/^[\\w-]+$/', $key)) { throw new Exception('Invalid characters in key'); } }