| Conditions | 4 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | 5 | public static function generateQueryString(Filter $filter = null): string |
|
| 29 | { |
||
| 30 | 5 | if (is_null($filter)) { |
|
| 31 | 2 | return ""; |
|
| 32 | } |
||
| 33 | |||
| 34 | 3 | $params = []; |
|
| 35 | 3 | $params['offset'] = $filter->getOffset(); |
|
| 36 | 3 | $params['limit'] = $filter->getLimit(); |
|
| 37 | 3 | if (! empty($filter->getSort())) { |
|
| 38 | 2 | $params['sort'] = $filter->getSort(); |
|
| 39 | } |
||
| 40 | 3 | if (! empty($filter->getQuery())) { |
|
| 41 | 1 | $params['query'] = $filter->getQuery(); |
|
| 42 | } |
||
| 43 | |||
| 44 | 3 | return build_query($params); |
|
| 45 | } |
||
| 47 |