Move LDAP code into separate class

Coalesce standalone functions into class objects, slowly move towards psr-0.