Php refactor internal method calls

This is gonna take a while.
Doing it in several PRs to avoid annoying conflicts and to make the CR not to insanely gigantic