portsoc / linbeta

7 stars 3 forks source link

Coding "Standards" #28

Closed ear1grey closed 10 years ago

ear1grey commented 10 years ago

Bring code into line with common coding standards such as this.

tpunt commented 10 years ago

The code base from commits 7bce70572b254bb2274eddb99f49bdf150bdb8a9 d6834e40664d5d1a9498976658d482c38f9b374b

Nearly puts the code base into PSR-1 compliance (it should be compliant with PSR-2), but there's two problematic files: log.php io.php

Both files declare symbols (functions in this case), and cause side effects (log.php opens a file if LOGGING is true, and io.php declares an evil global called $debug).

A potential solution to perhaps both of these problematic files would be to make their contents into classes. So upon initialising a new Log, the if statement at the bottom of log.php could be the constructor's body, and io.php could simply use $debug as an instance variable throughout its methods. Thoughts on this approach?

ear1grey commented 10 years ago

log.php is now removed. $debug is mostly obsolete so waste no time on it for now - it'll be better if it can be removed. Closing this - opened up new issue (#42) on $debug for fixing later.