protected function startSession($session)
    {
        if (is_bool($session) || is_string($session)) {
            if ($session === false || isset($_SESSION)) {
                return;
            }

            if (is_string($session)) {
                session_name($session);
            }

            return session_start();
        }

        $prefix = 'Session variable must be of type \'boolean\' or \'string\', \'';

        throw new \InvalidArgumentException($prefix . gettype($session) . '\' given.');
    }