final public function getConfig($key = null)
    {
        if (method_exists($this, 'getConfigData')) {
            if ($this->config === null) {
                $this->config = $this->getConfigData();
                if (!is_array($this->config)) {
                    throw new LogicException('Configuration provider should return an array');
                }
            }

            if (!is_null($key)) {
                if (isset($this->config[$key])) {
                    return $this->config[$key];
                } else {
                    trigger_error('Attempted to read non-existing configuration key');
                }
            } else {
                return $this->config;
            }

        } else {
            throw new RuntimeException(sprintf(
                'If you want to read configuration from modules, you should implement provideConfig() method that returns an array in %s', null
            ));
        }
    }