| Conditions | 8 |
| Paths | 10 |
| Total Lines | 31 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 8.0093 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 3 | public function extract() { |
|
| 17 | 3 | $result = []; |
|
| 18 | |||
| 19 | 3 | $model = $this->model; |
|
| 20 | 3 | $type = $model->type; |
|
| 21 | 3 | $parts = explode('.', $type); |
|
| 22 | 3 | if (!empty($parts[1]) && $parts[1] == 'upperName') { |
|
| 23 | $parts[1] = 'name'; |
||
| 24 | } |
||
| 25 | |||
| 26 | 3 | if ($model->value_option) { |
|
| 27 | 1 | $result['id'] = (int) $model->value_option; |
|
| 28 | 2 | } else if ($model->column_nbr !== null && $model->column_nbr !== '') { |
|
| 29 | $columnResult = [ |
||
| 30 | 1 | 'column' => $model->column_nbr |
|
| 31 | ]; |
||
| 32 | |||
| 33 | 1 | if (!empty($model->number_delimiter)) { |
|
| 34 | 1 | $columnResult['numberDelimiter'] = $model->number_delimiter; |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | $result[$parts[1]] = $columnResult; |
|
| 38 | 1 | } else if ($model->value_string) { |
|
| 39 | 1 | $result[$parts[1]] = [ |
|
| 40 | 1 | 'value' => $model->value_string, |
|
| 41 | ]; |
||
| 42 | } |
||
| 43 | |||
| 44 | return [ |
||
| 45 | 3 | $parts[0] => [ |
|
| 46 | 3 | 'attributes' => $result |
|
| 47 | ], |
||
| 50 | } |