| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace SearchReplace; |
||
| 31 | public function db() |
||
| 32 | { |
||
| 33 | $this->db = new \mysqli($this->host, $this->username, $this->password, $this->database); |
||
| 34 | |||
| 35 | if ($this->db->connect_errno) { |
||
| 36 | throw new Exception("Failed to connect to MySQL: (" . $this->db->connect_errno . ") " . $this->db->connect_error); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $this; |
||
| 40 | } |
||
| 41 | |||
| 70 |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.