01-28-2009, 08:09 PM
|
#71 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Can we please use brackets regardless if its one line or not, I can't tell you how much easier it makes code debugging not to mention readability.
Also a few methods could do we a quick refactor, alot of unneeded else's :
PHP Code:
public function connect() { $this->con = mysql_connect($this->host, $this->user, $this->pass); unset($this->pass); if($this->con) return $this; else return false; }
Because you are going to jump out with return if the connection was successful, this means that anytime the interpreter comes to the lines under the return, means that the above condition didnt equate to true, thus the operation failed. It could be written like this and still have the desired effect:
PHP Code:
public function connect() { $this->con = mysql_connect($this->host, $this->user, $this->pass); unset($this->pass); if($this->con) { return $this; } return false; }
Dont make the interpreter work for little to no gain :)
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|