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
            ));
        }
    }
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
            ));
        }
    }
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 ) ) ; } }
Returns module configuration key

@param string $key Optionally can be filtered by existing key
@throws \LogicException When getConfigData() doesn't return array, but another type of data
@throws \RuntimeException If module doesn't implement getConfigData() method
@return array
Returns module configuration key