HasGetQuery::removeParameterFromQuery()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Reviewsio\Endpoints;
4
5
trait HasGetQuery
6
{
7
    protected array $query = [];
8
9 2
    public function withQuery(array $query = []): static
10
    {
11 2
        $this->query = array_merge($this->query, $query);
12
13 2
        return $this;
14
    }
15
16 2
    public function addParameterToQuery(string $parameter, mixed $value = null): static
17
    {
18 2
        $this->query[$parameter] = $value;
19
20 2
        return $this;
21
    }
22
23 1
    public function removeParameterFromQuery(string $parameter): static
24
    {
25 1
        if (isset($this->query[$parameter])) {
26 1
            unset($this->query[$parameter]);
27
        }
28
29 1
        return $this;
30
    }
31
32 2
    public function query(): array
33
    {
34 2
        return $this->query;
35
    }
36
}
37