Php refactor internal method calls

This is gonna take a while.
Doing it in several PRs to avoid annoying conflicts