Conditions | 4 |
Paths | 8 |
Total Lines | 25 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4.0092 |
Changes | 0 |
1 | <?php |
||
10 | 2 | public function createRouter(QueryBuilderOptions $queryOptions, $routeName) :Route |
|
11 | { |
||
12 | 2 | $params = []; |
|
13 | 2 | $routeParams = []; |
|
14 | |||
15 | 2 | if (null != $queryOptions->get('_route_params')) { |
|
16 | 1 | $routeParams = array_keys($queryOptions->get('_route_params')); |
|
17 | } |
||
18 | |||
19 | 2 | $list = array_merge([ |
|
20 | 2 | 'filtering', |
|
21 | 'limit', |
||
22 | 'page', |
||
23 | 'sorting', |
||
24 | ], $routeParams); |
||
25 | |||
26 | 2 | foreach ($list as $itemKey => $itemValue) { |
|
27 | 2 | $params[$itemValue] = $queryOptions->get($itemValue); |
|
28 | } |
||
29 | |||
30 | 2 | if (!isset($routeName)) { |
|
31 | $routeName = $queryOptions->get('_route'); |
||
32 | } |
||
33 | |||
34 | 2 | return new Route($routeName, $params); |
|
35 | } |
||
36 | } |