public function config($config = null)
    {
        $register_function = false;

        if (!empty($config)) {
            if (is_array($config)) {
                if (isset($config['exit_allowed'])) {
                    $this->config['exit_allowed'] = (bool)$config['exit_allowed'];
                }

                if (isset($config['auto_session'])) {
                    $this->config['auto_session'] = (bool)$config['auto_session'];
                }

                if (isset($config['return'])) {
                    $this->config['return'] = (bool)$config['return'];
                }

                if (isset($config['set_always_available'])) {
                    $this->config['set_always_available'] = (bool)$config['set_always_available'];
                }

                if (isset($config['exceptions'])) {
                    $this->config['exceptions'] = (bool)$config['exceptions'];
                }

                if (isset($config['csrf'])) {
                    $this->config['csrf'] = (bool)$config['csrf'];
                }

                if (isset($config['error_reporting'])) {
                    if ($config['error_reporting'] !== false) {
                        $this->config['error_reporting'] = (int)$config['error_reporting'];
                    } else {
                        $this->config['error_reporting'] = false;
                    }

                    $register_function = true;
                }

                if ($register_function || $this->init) {
                    register_shutdown_function(sprintf('%s::shutdown_handler', __CLASS__), $this->config['error_reporting'] !== false);
                    $this->init = false;
                }

                return $this;
            } elseif (!empty($config) && is_string($config) && isset($this->config[$config])) {
                return $this->config[$config];
            }
        }

        return $this->config;
    }