Conditions | 4 |
Paths | 9 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
13 | 3 | public function convert(Request $request) |
|
14 | { |
||
15 | try { |
||
16 | 3 | $parameters = $request->request->all(); |
|
17 | |||
18 | 3 | if (array_key_exists('command', $parameters)) { |
|
19 | 1 | return new SlashCommand($parameters); |
|
20 | 2 | } elseif (empty($parameters)) { |
|
21 | 2 | $parameters = $request->query->all(); |
|
22 | 2 | } |
|
23 | |||
24 | 2 | return new WebHook($parameters); |
|
25 | 1 | } catch (\Exception $exception) { |
|
26 | 1 | throw new UnexpectedValueException('Request could not be converted.', 0, $exception); |
|
27 | } |
||
28 | } |
||
29 | } |
||
30 |