| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | 3 | public function connect($host, $user, $pass, $name) |
|
| 26 | { |
||
| 27 | try { |
||
| 28 | 3 | $this->pdo = new \PDO("mysql:{$host};dbname={$name}", $user, $pass); |
|
| 29 | |||
| 30 | 2 | $connected = true; |
|
| 31 | 3 | } catch (\PDOException $pdo_e) { |
|
| 32 | 1 | $context["exception"] = $pdo_e; |
|
| 33 | |||
| 34 | 1 | $this->updateLog("error", "MySQL connection failed with the following message: {message}", $context); |
|
| 35 | |||
| 36 | 1 | $connected = false; |
|
| 37 | } |
||
| 38 | |||
| 39 | 3 | return $connected; |
|
| 40 | } |
||
| 41 | |||
| 58 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.