Using some lazy PHP reflection instead of duplicating code across
classes
stripping trailing whitespace