| Conditions | 3 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 15 | public function getFromRequest(Request $request, string $parameter, bool $urlDecode = false): ?string |
||
| 16 | { |
||
| 17 | $param = $request->query->get($parameter); |
||
| 18 | |||
| 19 | if ($urlDecode) { |
||
| 20 | $param = urldecode($param); |
||
| 21 | } |
||
| 22 | |||
| 23 | $searchQuery = filter_var($param, FILTER_SANITIZE_STRING); |
||
| 24 | |||
| 25 | return !empty($searchQuery) ? $searchQuery : null; |
||
| 26 | } |
||
| 28 |