Nette\Http\Session::configure PHP Method

configure() private method

Configures session environment.
private configure ( array $config ) : void
$config array
return void
    private function configure(array $config)
    {
        $special = ['cache_expire' => 1, 'cache_limiter' => 1, 'save_path' => 1, 'name' => 1];
        foreach ($config as $key => $value) {
            if (!strncmp($key, 'session.', 8)) {
                // back compatibility
                $key = substr($key, 8);
            }
            $key = strtolower(preg_replace('#(.)(?=[A-Z])#', '$1_', $key));
            if ($value === NULL || ini_get("session.{$key}") == $value) {
                // intentionally ==
                continue;
            } elseif (strncmp($key, 'cookie_', 7) === 0) {
                if (!isset($cookie)) {
                    $cookie = session_get_cookie_params();
                }
                $cookie[substr($key, 7)] = $value;
            } else {
                if (session_status() === PHP_SESSION_ACTIVE) {
                    throw new Nette\InvalidStateException("Unable to set 'session.{$key}' to value '{$value}' when session has been started" . (self::$started ? '.' : ' by session.auto_start or session_start().'));
                }
                if (isset($special[$key])) {
                    $key = "session_{$key}";
                    $key($value);
                } elseif (function_exists('ini_set')) {
                    ini_set("session.{$key}", (string) $value);
                } elseif (ini_get("session.{$key}") != $value) {
                    // intentionally !=
                    throw new Nette\NotSupportedException("Unable to set 'session.{$key}' to '{$value}' because function ini_set() is disabled.");
                }
            }
        }
        if (isset($cookie)) {
            session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
            if (self::$started) {
                $this->sendCookie();
            }
        }
        if ($this->handler) {
            session_set_save_handler($this->handler);
        }
    }