can anyone recommend tools/plugins that are capable of "normalizing" the coding style of a php document?
Oftentimes I find myself working on outdated codebase by different authors following different or no coding style at all. Before working on those documents, I often find I have to clean up the code and for quite a few things I just do a regexp search & replace, like fixing brace indentation, new lines, dot-connectors, spaces around operators and so forth...
I use Aptana Studio and like the default php formatting it offers, which is great for writing new code that conforms to a coding style. What I am looking for would ideally be some sort of tool or plugin that could take EXISTING code and even just slightly adopt it to a given coding style (or even set of regexp search & replace's).
Anyone got any hints?
P.S.: Please do note that I am not per se asking for advice on enforcing coding standards, but rather on how to automatize the adaptation of old code base to a coding standard.
Edit: I found this topic Aptana auto format: Aptana supports formatting of code to the active coding style via shortcut cmd + shift + f. From what I've tried so far, it behaves a bit weird and not exactly producing the kind of output I'd expect. So, while this might be something I could get to work, and would still be interested in other solutions to this.
Edit #2: Also found this topic How to format code on aptana 3? stating that folder/project wide reformatting is not possible in Aptana as of yet.
Edit #3: Awared the link to the PEAR Code Beautifier with the correct answer. It requires some reading yourself into :) Personally, I find most closely to what I am looking for was Aptana's / Net Beans' source formatting tools. For completeness sake, I also found a windows command line tool which looked promissing: http://www.waterproof.fr/products/phpCodeBeautifier/