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   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 33
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B parseSearchParams() 0 25 6
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
}