Conditions | 2 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
46 | private function setdata() |
||
47 | { |
||
48 | $fields = implode(', ', array_keys($this->data)); |
||
49 | $places = ':'.implode(', :', array_keys($this->data)); |
||
50 | $this->create = "INSERT INTO {$this->table} ({$fields}) VALUES ({$places})"; |
||
51 | |||
52 | try{ |
||
53 | |||
54 | $this->statements = DB::connect()->prepare($this->create); |
||
55 | $this->statements->execute($this->data); |
||
56 | $this->result = DB::connect()->lastInsertId(); |
||
57 | $this->error = true; |
||
58 | |||
59 | }catch (\PDOException $e){ |
||
60 | echo $e->getMessage(); |
||
61 | |||
66 | } |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.