Domain Mapping w/ SSL

I have two questions:

1) What is the code in the attached image do? https://drive.google.com/file/d/14CB5DtgLUBEht43rBi29l8NvybiITAik/view?usp=sharing

2) Why does it not change the schema to https when a site has ssl & is configured that way?