Central login and autologin are key pieces of functionality in CentralAuth, but the code is a bit of a spaghetti. We should probably create dedicated helper classes which:
- group code by function (e.g. right now the first step of central login is in LoginCompleteHookHandler and the second and third in SpecialCentralLogin)
- do not have huge methods doing a dozen different things (this is really just a problem with Special:CentralAutoLogin::execute())
- do not directly access global state
- return / throw errors instead of directly printing them
- are PHPUnit testable (and actually tested)