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.
Passed
Push — fix/114/2.2 ( 623935 )
by Simone
05:27
created

QueryBuilderOptions   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 48%

Importance

Changes 0
Metric Value
wmc 13
dl 0
loc 60
ccs 12
cts 25
cp 0.48
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 3 1
A __construct() 0 3 1
B get() 0 16 5
A getRel() 0 3 1
A getSorting() 0 3 1
A getPrinting() 0 3 1
A getOrFilters() 0 3 1
A getSelect() 0 3 1
A getAndFilters() 0 3 1
1
<?php
2
3
namespace Mado\QueryBundle\Queries;
4
5
class QueryBuilderOptions
6
{
7
    private $options;
8
9 1
    private function __construct(array $options)
10
    {
11 1
        $this->options = $options;
12 1
    }
13
14 1
    public static function fromArray(array $options)
15
    {
16 1
        return new self($options);
17
    }
18
19 1
    public function get($option, $defaultValue = null)
20
    {
21 1
        if ('limit' == $option) {
22 1
            if (-1 == $this->options[$option]) {
23 1
                $this->options[$option] = PHP_INT_MAX;
24
            }
25
        }
26
27
        if (
28 1
            !isset($this->options[$option])
29 1
            || empty($this->options[$option])
30
        ) {
31
            return $defaultValue;
32
        }
33
34 1
        return $this->options[$option];
35
    }
36
37
    public function getAndFilters()
38
    {
39
        return $this->get('filters', []);
40
    }
41
42
    public function getOrFilters()
43
    {
44
        return $this->get('orFilters', []);
45
    }
46
47
    public function getSorting()
48
    {
49
        return $this->get('sorting', []);
50
    }
51
52
    public function getRel()
53
    {
54
        return $this->get('rel');
55
    }
56
57
    public function getPrinting()
58
    {
59
        return $this->get('printing', []);
60
    }
61
62
    public function getSelect()
63
    {
64
        return $this->get('select');
65
    }
66
}
67