Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | 2 | public function get(): array |
|
40 | { |
||
41 | 2 | $properties = []; |
|
42 | 2 | $model = $this->model::make(); |
|
43 | 2 | $table = $model->getTable(); |
|
44 | 2 | $connection = $model->getConnection(); |
|
45 | |||
46 | 2 | foreach (Schema::getColumnListing($table) as $name) { |
|
47 | 2 | $column = $connection->getDoctrineColumn($table, $name); |
|
48 | 2 | $properties[$name] = $property = new Property(); |
|
49 | 2 | $property->name = $name; |
|
50 | 2 | $property->dbType = Schema::getColumnType($table, $name); |
|
51 | 2 | $property->nullable = !$column->getNotnull(); |
|
52 | 2 | $property->default = $column->getDefault(); |
|
53 | 2 | $property->type = $this->typesMap[$property->dbType] ?? throw new UnknownType($this->model, $property); |
|
54 | } |
||
55 | |||
56 | 1 | return $properties; |
|
57 | } |
||
59 |