| Conditions | 1 |
| Paths | 1 |
| Total Lines | 31 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 1 |
| Changes | 7 | ||
| Bugs | 0 | Features | 7 |
| 1 | <?php |
||
| 17 | 1 | public function init() |
|
| 18 | {
|
||
| 19 | |||
| 20 | 1 | $this->db->dropTableIfExists("colors");
|
|
|
|
|||
| 21 | 1 | $this->db->execute(); |
|
| 22 | 1 | $this->db->createTable( |
|
| 23 | 1 | 'colors', |
|
| 24 | [ |
||
| 25 | 1 | 'id' => ['integer', 'auto_increment', 'primary key', 'not null'], |
|
| 26 | 1 | 'name' => ['varchar(20)'], |
|
| 27 | 1 | 'color' => ['varchar(20)'], |
|
| 28 | ] |
||
| 29 | 1 | ); |
|
| 30 | 1 | $this->db->execute(); |
|
| 31 | 1 | $this->db->insert( |
|
| 32 | 1 | 'colors', |
|
| 33 | 1 | ['name', 'color'] |
|
| 34 | 1 | ); |
|
| 35 | 1 | $this->db->execute(['Sofia', 'Red']); |
|
| 36 | 1 | $this->db->execute(['Olle', 'Blue']); |
|
| 37 | 1 | $this->db->execute(['Pia', 'Green']); |
|
| 38 | |||
| 39 | |||
| 40 | /* |
||
| 41 | $this->db->select("*")
|
||
| 42 | ->from("colors")
|
||
| 43 | ; |
||
| 44 | var_dump($this->db->executeFetchAll()); |
||
| 45 | */ |
||
| 46 | |||
| 47 | 1 | } |
|
| 48 | |||
| 49 | } |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.