[Libguestfs] [PATCH 2/4] php: move common code in helper functions