Move abstract for php versions into a class

Fixes issue #987