| Total Complexity | 8 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Coverage | 86.96% |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | class Db extends MysqliDb implements Db_Interface |
||
| 22 | { |
||
| 23 | public $host = 'localhost'; |
||
| 24 | public $user = 'pdns'; |
||
| 25 | public $password = ''; |
||
| 26 | public $database = 'pdns'; |
||
| 27 | public $type = 'mdb2'; |
||
| 28 | public $error = false; |
||
| 29 | public $message = ''; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Db::quote() |
||
| 33 | * @param string $text |
||
| 34 | * @param string $type |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | 1 | public function quote($text = '', $type = 'text') |
|
| 38 | { |
||
| 39 | switch ($type) { |
||
| 40 | 1 | case 'text': |
|
| 41 | 1 | return "'".$this->escape($text)."'"; |
|
| 42 | break; |
||
|
|
|||
| 43 | 1 | case 'integer': |
|
| 44 | 1 | return (int) $text; |
|
| 45 | break; |
||
| 46 | default: |
||
| 47 | 1 | return $text; |
|
| 48 | break; |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Db::queryOne() |
||
| 54 | * |
||
| 55 | * @param mixed $query |
||
| 56 | * @param string $line |
||
| 57 | * @param string $file |
||
| 58 | * @return bool |
||
| 59 | */ |
||
| 60 | 1 | public function queryOne($query, $line = '', $file = '') |
|
| 61 | { |
||
| 62 | 1 | $this->query($query, $line, $file); |
|
| 63 | 1 | if ($this->num_rows() > 0) { |
|
| 64 | 1 | $this->next_record(); |
|
| 65 | 1 | return $this->f(0); |
|
| 66 | } else { |
||
| 67 | 1 | return 0; |
|
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Db::queryRow() |
||
| 73 | * |
||
| 74 | * @param mixed $query |
||
| 75 | * @param string $line |
||
| 76 | * @param string $file |
||
| 77 | * @return array|bool |
||
| 78 | */ |
||
| 79 | 1 | public function queryRow($query, $line = '', $file = '') |
|
| 80 | { |
||
| 81 | 1 | $this->query($query, $line, $file); |
|
| 82 | 1 | if ($this->num_rows() > 0) { |
|
| 83 | 1 | $this->next_record(); |
|
| 84 | 1 | return $this->Record; |
|
| 85 | } else { |
||
| 86 | 1 | return 0; |
|
| 87 | } |
||
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Db::lastInsertId() |
||
| 92 | * @param mixed $table |
||
| 93 | * @param mixed $field |
||
| 94 | * @return int |
||
| 95 | */ |
||
| 96 | 1 | public function lastInsertId($table, $field) |
|
| 99 | } |
||
| 100 | } |
||
| 101 |
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.