FilterParameter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 56
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getAttribute() 0 4 1
A getRelationship() 0 4 1
A getOperationsWithArguments() 0 4 1
1
<?php declare (strict_types = 1);
2
3
namespace Limoncello\Flute\Http\Query;
4
5
/**
6
 * Copyright 2015-2019 [email protected]
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
use Limoncello\Flute\Contracts\Http\Query\AttributeInterface;
22
use Limoncello\Flute\Contracts\Http\Query\FilterParameterInterface;
23
use Limoncello\Flute\Contracts\Http\Query\RelationshipInterface;
24
25
/**
26
 * @package Limoncello\Flute
27
 */
28
class FilterParameter implements FilterParameterInterface
29
{
30
    /**
31
     * @var AttributeInterface
32
     */
33
    private $attribute;
34
35
    /**
36
     * @var RelationshipInterface|null
37
     */
38
    private $relationship;
39
40
    /**
41
     * @var iterable
42
     */
43
    private $operationsWithArguments;
44
45
    /**
46
     * @param AttributeInterface         $attribute
47
     * @param iterable                   $operationsWithArgs
48
     * @param RelationshipInterface|null $relationship
49
     */
50 9
    public function __construct(
51
        AttributeInterface $attribute,
52
        iterable $operationsWithArgs,
53
        RelationshipInterface $relationship = null
54
    ) {
55 9
        $this->attribute               = $attribute;
56 9
        $this->relationship            = $relationship;
57 9
        $this->operationsWithArguments = $operationsWithArgs;
58
    }
59
60
    /**
61
     * @inheritdoc
62
     */
63 8
    public function getAttribute(): AttributeInterface
64
    {
65 8
        return $this->attribute;
66
    }
67
68
    /**
69
     * @inheritdoc
70
     */
71 8
    public function getRelationship(): ?RelationshipInterface
72
    {
73 8
        return $this->relationship;
74
    }
75
76
    /**
77
     * @inheritdoc
78
     */
79 9
    public function getOperationsWithArguments(): iterable
80
    {
81 9
        return $this->operationsWithArguments;
82
    }
83
}
84