Conditions | 5 |
Paths | 12 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | 1 | public function toArray() |
|
44 | { |
||
45 | 1 | $initialOptions = []; |
|
46 | |||
47 | 1 | $data = [ |
|
48 | 1 | 'type' => $this->getType(), |
|
49 | 1 | 'action_id' => $this->getActionId(), |
|
50 | 1 | 'options' => $this->getOptionsAsArrays(), |
|
51 | ]; |
||
52 | |||
53 | 1 | foreach ($this->getOptions() as $option) { |
|
54 | 1 | if ($option->isInitiallySelected()) { |
|
55 | 1 | $initialOptions[] = $option->toArray(); |
|
56 | } |
||
57 | } |
||
58 | |||
59 | 1 | if (count($initialOptions)) { |
|
60 | 1 | $data['initial_options'] = $initialOptions; |
|
61 | } |
||
62 | |||
63 | 1 | if ($this->getConfirm()) { |
|
64 | 1 | $data['confirm'] = $this->getConfirm()->toArray(); |
|
65 | } |
||
66 | |||
67 | 1 | return $data; |
|
68 | } |
||
70 |