Fix notice in determination of next connection Id
Refactoring PHP classes