GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a11bd1...3fc1f5 )
by Anderson
02:01
created

SearchParser::parseSearchParams()   B

Complexity

Conditions 6
Paths 16

Size

Total Lines 25
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 8.439
c 0
b 0
f 0
cc 6
eloc 14
nc 16
nop 1
1
<?php
2
3
namespace DoctrineElastic\Elastic;
4
5
/**
6
 * Search params, used to make interface between elastic api queries and this extension queries
7
 *
8
 * @author Ands
9
 */
10
class SearchParser {
11
12
    /**
13
     * @param SearchParams $searchParams
14
     * @return array
15
     */
16
    public static function parseSearchParams(SearchParams $searchParams) {
17
        $elasticQuerySearch = array(
18
            'index' => $searchParams->getIndex(),
19
            'type' => $searchParams->getType(),
20
            'body' => $searchParams->getBody()
21
        );
22
23
        if (boolval($searchParams->getParent()) && is_string($searchParams->getParent())) {
24
            $elasticQuerySearch['routing'] = $searchParams->getParent();
25
        }
26
27
        if (is_numeric($searchParams->getSize())) {
28
            $elasticQuerySearch['size'] = $searchParams->getSize();
29
        }
30
31
        foreach ($searchParams->getSort() as $field => $value) {
32
            $elasticQuerySearch['body']['sort'][] = [$field => $value];
33
        }
34
35
        if ($searchParams->getFrom()) {
36
            $elasticQuerySearch['from'] = $searchParams->getFrom();
37
        }
38
39
        return $elasticQuerySearch;
40
    }
41
42
}