Generating valid PHP code within visit method