Switching mechanisms in cobalt phosphorus thin films