| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function create(): void |
||
| 31 | { |
||
| 32 | if (empty($this->values)) { |
||
| 33 | throw new OperationException('Values can\'t be empty'); |
||
| 34 | } |
||
| 35 | |||
| 36 | $values = implode(',', array_map(static fn($v) => "'{$v}'", $this->values)); |
||
| 37 | |||
| 38 | $query = sprintf( |
||
| 39 | 'CREATE TYPE %s AS %s (%s);', |
||
| 40 | $this->name, |
||
| 41 | $this->type, |
||
| 42 | $values |
||
| 43 | ); |
||
| 44 | |||
| 45 | $this->db->execute($query); |
||
| 46 | $this->db->commit(); |
||
| 47 | } |
||
| 64 |