domain mapping not honoring https for cookie checks

private function _get_sso_endpoint_url( $subsite = false, $domain = null){
                global $wp_rewrite, $current_blog, $current_site;

                if( $subsite ){
                        $domain = is_null( $domain ) ? $current_blog->domain : $domain;
                        $subsite_scheme = 'https'; // ben ben self::utils()->get_mapped_domain_scheme( $domain );
                        $url  = trailingslashit( set_url_scheme( "http://" . $domain, $subsite_scheme ) );
                }else{
                        $admin_scheme = 'https'; // ben ben self::utils()->get_admin_scheme() ? self::utils()->get_admin_scheme() : "http";
                        $url  = trailingslashit( set_url_scheme( network_home_url("/"), $admin_scheme ) );
                }

                return $wp_rewrite->using_permalinks() ? $url . self::SSO_ENDPOINT . "/" . time() . "/" : $url . "?" . self::SSO_ENDPOINT . "=" . time() ;
        }

Developer please review my code on the fix (see where I commented)

Please note that each of those checks take more overhead than necessary.
Would be good if there was an option to set a wp-config constant defined variable for:

$admin_scheme
$subsite_scheme

Would save the use of many functions and a database lookup...so less memory...faster response...less work for the server...

Thoughts?