using php tokenizer. refactoring code