| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class Create extends Base |
||
| 10 | { |
||
| 11 | protected function mountQuery(): void |
||
| 12 | { |
||
| 13 | $columns = implode(", ", array_keys($this->fields)); |
||
| 14 | $values = implode(',', array_fill(0, count($this->fields), '?')); |
||
| 15 | |||
| 16 | $this->query = "INSERT INTO {$this->entity} ({$columns}) VALUES ({$values})"; |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param array $data |
||
| 21 | * @return Create |
||
| 22 | */ |
||
| 23 | public function create(array $data): static |
||
| 24 | { |
||
| 25 | $this->setBindings(array_values($data), 'create'); |
||
| 26 | |||
| 27 | $this->fields = $data; |
||
| 28 | |||
| 29 | return $this; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param array $data |
||
| 34 | */ |
||
| 35 | public function exec(): ?int |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 |