| Total Complexity | 7 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | trait Statement |
||
| 6 | { |
||
| 7 | private $statement; |
||
| 8 | private $attributes = []; |
||
| 9 | |||
| 10 | 2 | public function create(string $table, array $attributes): self |
|
| 11 | { |
||
| 12 | 2 | $this->attributes = $attributes; |
|
| 13 | 2 | $this->statement = 'INSERT INTO `' . $table . '` (`'; |
|
| 14 | 2 | $this->statement .= Tool::getAttributesKey($attributes); |
|
| 15 | 2 | $this->statement .= '`) VALUES (:'; |
|
| 16 | 2 | $this->statement .= Tool::getAttributesValue($attributes) . ')'; |
|
| 17 | 2 | return $this; |
|
| 18 | } |
||
| 19 | |||
| 20 | 2 | public function all(string $table): self |
|
| 21 | { |
||
| 22 | 2 | $this->statement = "SELECT * FROM `{$table}`"; |
|
| 23 | 2 | return $this; |
|
| 24 | } |
||
| 25 | |||
| 26 | 2 | public function select(string $table, array $columns): self |
|
| 27 | { |
||
| 28 | 2 | $this->statement = 'SELECT `' . Tool::columns($columns) . "` FROM `{$table}`"; |
|
| 29 | 2 | return $this; |
|
| 30 | } |
||
| 31 | |||
| 32 | 2 | public function update(string $table, array $attributes): self |
|
| 49 | } |
||
| 50 | |||
| 51 | 2 | public function delete(string $table): self |
|
| 52 | { |
||
| 57 |