| Total Complexity | 8 | 
| Total Lines | 56 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 3 | ||
| Bugs | 1 | Features | 1 | 
| 1 | <?php | ||
| 19 | class DBCreateTable | ||
| 20 | { | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Private variable to store the name of the field to create | ||
| 24 | * | ||
| 25 | * @var array | ||
| 26 | */ | ||
| 27 | private array $data; | ||
| 28 | |||
| 29 | /** | ||
| 30 | * Constructor | ||
| 31 | * | ||
| 32 | * @param string $field | ||
| 33 | * @param string $datatype | ||
| 34 | * @param string $default | ||
| 35 | * @param string $option | ||
| 36 | */ | ||
| 37 | 3 | public function __construct(string $field, string $datatype, ?string $default = null, ?string $option = null) | |
| 44 | ]; | ||
| 45 | 3 | } | |
| 46 | |||
| 47 | /** | ||
| 48 | * Magic setter method | ||
| 49 | * | ||
| 50 | * @param string $name | ||
| 51 | * @param string|int|null $value | ||
| 52 | * | ||
| 53 | * @throws InvalidArgumentException | ||
| 54 | */ | ||
| 55 | 2 | public function __set(string $name, $value) | |
| 56 |     { | ||
| 57 | 2 |         if (!in_array($name, ['field', 'datatype', 'default', 'option'])) { | |
| 58 | 1 |             throw new InvalidArgumentException("Invalid property in CreateTable"); | |
| 59 | } | ||
| 60 | |||
| 61 | 1 | $this->data[$name] = $value; | |
| 62 | 1 | } | |
| 63 | |||
| 64 | /** | ||
| 65 | * Magic method to convert the class to a string | ||
| 66 | * | ||
| 67 | * @return string | ||
| 68 | */ | ||
| 69 | 2 | public function __toString(): string | |
| 75 | } | ||
| 76 | } | ||
| 77 |