Conditions | 2 |
Paths | 1 |
Total Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
40 | public static function createFromIlluminateRequest(IlluminateRequest $illuminateRequest): self |
||
41 | { |
||
42 | return collect([ |
||
43 | 'token', |
||
44 | 'teamId', |
||
45 | 'teamDomain', |
||
46 | 'channelId', |
||
47 | 'channelName', |
||
48 | 'userId', |
||
49 | 'userName', |
||
50 | 'command', |
||
51 | 'text', |
||
52 | 'responseUrl', |
||
53 | ])->reduce(function (self $request, string $propertyName) use ($illuminateRequest) { |
||
54 | $request->$propertyName = $illuminateRequest->get(Str::snake($propertyName)); |
||
55 | |||
56 | if ($propertyName == 'command') { |
||
57 | |||
58 | //remove slash |
||
59 | $request->command = substr($request->command, 1); |
||
60 | } |
||
61 | |||
62 | return $request; |
||
63 | }, new static()); |
||
64 | } |
||
65 | |||
76 |