Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public static function createForRequest(Request $request): SlashCommandData |
||
37 | { |
||
38 | return collect([ |
||
39 | 'token', |
||
40 | 'team_id', |
||
41 | 'team_domain', |
||
42 | 'channel_id', |
||
43 | 'channel_name', |
||
44 | 'user_id', |
||
45 | 'user_name', |
||
46 | 'command', |
||
47 | 'text', |
||
48 | 'reponse_url' |
||
49 | ])->reduce(function (SlashCommandData $slashCommandData, string $slackFieldName) use ($request) { |
||
50 | $propertyName = camel_case($slackFieldName); |
||
51 | |||
52 | $slashCommandData->$propertyName = $request->get($slackFieldName); |
||
53 | |||
54 | return $slashCommandData; |
||
55 | }, new static()); |
||
56 | } |
||
57 | } |
||
58 |