Rework PHP parser

Migrated issue

Reported by: drumm

The first pass of the PHP parser is to chunk up code into objects such as functions, constants and globals. Currently, this uses regular expressions and depends on things like functions starting with /^f/ and ending with the first /^}$/.

Instead, PHP's tokenizer should be used. This will fix the issues and pave the way for documenting object-oriented code. The API should be standardized so other file types, like CSS and JS, can be parsed in the future.

Unit tests will be required.