Conditions | 2 |
Paths | 1 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
58 | 1 | public function prepareBody() { |
|
59 | 2 | return Experiment::all()->map(function ($item) { |
|
60 | 3 | $return = [$item->name, $item->visitors]; |
|
61 | |||
62 | 2 | $goalConversations = $item->goals->pluck('hit')->map(function ($hit) use ($item) { |
|
63 | 3 | $item->visitors = $item->visitors ?: 1; // prevent division by zero exception |
|
64 | |||
65 | 3 | return $hit.' ('.number_format($hit / $item->visitors * 100).'%)'; |
|
66 | 3 | }); |
|
67 | |||
68 | 3 | return array_merge($return, $goalConversations->toArray()); |
|
69 | 3 | }); |
|
70 | } |
||
71 | } |
||
72 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.