Corrected code style to match PSR-2

PSR-2 [1] specifies some sensible coding style rules, many of which
are shared by the Zend specification.

This commit fixes all library code to conform with this standard
(except for one remaining error, which require autoloading to fix).
The standard was validated automatically using PHP_CodeSniffer [2].
Changes include:
 - pushing opening braces of classes / functions onto a new line
 - using lower-case versions of "NULL", "TRUE" and "FALSE"
 - adding spaces after "if" and "foreach" statements
 - removing inline "if" statements

[1] https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
[2] http://pear.php.net/package/PHP_CodeSniffer/