Refactoring for short syntax php