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