Fix typos.
Minor PHPDoc update.
Minor refactoring.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>