Conditions | 2 |
Paths | 1 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
59 | 3 | public function prepareBody() |
|
60 | { |
||
61 | return Experiment::all()->map(function ($item) { |
||
62 | 3 | $return = [$item->name, $item->visitors]; |
|
63 | |||
64 | $goalConversations = $item->goals->pluck('hit')->map(function ($hit) use ($item) { |
||
65 | 3 | $item->visitors = $item->visitors ?: 1; // prevent division by zero exception |
|
66 | |||
67 | 3 | return $hit.' ('.number_format($hit / $item->visitors * 100).'%)'; |
|
68 | 3 | }); |
|
69 | |||
70 | 3 | return array_merge($return, $goalConversations->toArray()); |
|
71 | 3 | }); |
|
72 | } |
||
73 | } |
||
74 |
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.