Correct php code with OOP