| Total Complexity | 8 |
| Total Lines | 71 |
| Duplicated Lines | 0 % |
| Coverage | 86.96% |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class Db extends MysqliDb implements Db_Interface { |
||
| 22 | public $host = 'localhost'; |
||
| 23 | public $user = 'pdns'; |
||
| 24 | public $password = ''; |
||
| 25 | public $database = 'pdns'; |
||
| 26 | public $type = 'mdb2'; |
||
| 27 | public $error = false; |
||
| 28 | public $message = ''; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Db::quote() |
||
| 32 | * @param string $text |
||
| 33 | * @param string $type |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | 1 | public function quote($text = '', $type = 'text') { |
|
| 37 | switch ($type) { |
||
| 38 | 1 | case 'text': |
|
| 39 | 1 | return "'".$this->escape($text)."'"; |
|
| 40 | break; |
||
|
|
|||
| 41 | 1 | case 'integer': |
|
| 42 | 1 | return (int) $text; |
|
| 43 | break; |
||
| 44 | default: |
||
| 45 | 1 | return $text; |
|
| 46 | break; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Db::queryOne() |
||
| 52 | * |
||
| 53 | * @param mixed $query |
||
| 54 | * @param string $line |
||
| 55 | * @param string $file |
||
| 56 | * @return bool |
||
| 57 | */ |
||
| 58 | 1 | public function queryOne($query, $line = '', $file = '') { |
|
| 59 | 1 | $this->query($query, $line, $file); |
|
| 60 | 1 | if ($this->num_rows() > 0) { |
|
| 61 | 1 | $this->next_record(); |
|
| 62 | 1 | return $this->f(0); |
|
| 63 | } else |
||
| 64 | 1 | return 0; |
|
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Db::queryRow() |
||
| 69 | * |
||
| 70 | * @param mixed $query |
||
| 71 | * @param string $line |
||
| 72 | * @param string $file |
||
| 73 | * @return array|bool |
||
| 74 | */ |
||
| 75 | 1 | public function queryRow($query, $line = '', $file = '') { |
|
| 76 | 1 | $this->query($query, $line, $file); |
|
| 77 | 1 | if ($this->num_rows() > 0) { |
|
| 78 | 1 | $this->next_record(); |
|
| 79 | 1 | return $this->Record; |
|
| 80 | } else |
||
| 81 | 1 | return 0; |
|
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Db::lastInsertId() |
||
| 86 | * @param mixed $table |
||
| 87 | * @param mixed $field |
||
| 88 | * @return int |
||
| 89 | */ |
||
| 90 | 1 | public function lastInsertId($table, $field) { |
|
| 92 | } |
||
| 93 | } |
||
| 94 |
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.