Updated code to PSR standards

Code has been broken out into separate files, given a namespace, and
should be closer to the standards outlined by the PHP Framework
Interoperability group.  Because why not?  Note:  This code is untested,
and will probably break things.
More PSR shenanigans