Refine addPatroller function in php