protected function getConfig($key = null)
    {
        if ($this->config === null) {
            $this->setConfig();
        }

        if (null === $key) {
            return $this->config;
        }

        if (!array_key_exists($key, $this->config)) {
            throw new InvalidArgumentException("key: '" . $key . "' is not set in configuration options.");
        }

        return $this->config[$key];
    }