Conditions | 4 |
Paths | 5 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 5.4042 |
Changes | 0 |
1 | <?php |
||
24 | 1 | public function getRequest(string $key = null, $default = null) |
|
25 | { |
||
26 | 1 | if ($this->request === null) { |
|
27 | return null; |
||
28 | } |
||
29 | |||
30 | try { |
||
31 | 1 | $contents = json_decode($this->request->getBody()->getContents(), true); |
|
32 | |||
33 | 1 | if ($contents === null) { |
|
34 | return null; |
||
35 | } |
||
36 | |||
37 | 1 | return Arr::get($contents, $key, $default); |
|
38 | } catch (RuntimeException $exception) { |
||
39 | return null; |
||
40 | } |
||
41 | } |
||
42 | |||
82 |