Completed
Push — master ( 2975e7...46c3ee )
by Rafael
07:49
created

NodeComparisonExpression   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 46
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getOp() 0 3 1
A getNodes() 0 3 1
A setOp() 0 3 1
A setNodes() 0 3 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Model\Filter;
12
13
use Ynlo\GraphQLBundle\Annotation as GraphQL;
14
use Ynlo\GraphQLBundle\Model\NodeInterface;
15
use Ynlo\GraphQLBundle\Type\NodeComparisonOperatorType;
16
17
/**
18
 * @GraphQL\InputObjectType(
19
 *     description="Create Node comparison expression to filter values by related nodes.
20
21
#### Example:
22
23
Include all values with given ids
24
````
25
value: ['Q2nk6MQ==', 'Q2cnk6Mg==']
26
````
27
28
or exclude values with given ids
29
````
30
op: NIN
31
value: ['Q2nk6MQ==', 'Q2cnk6Mg==']
32
````
33
")
34
 */
35
class NodeComparisonExpression
36
{
37
    /**
38
     * @var string|null
39
     *
40
     * @GraphQL\Field(type="NodeComparisonOperator", description="Comparison operator, default `IN`")
41
     */
42
    private $op = NodeComparisonOperatorType::IN;
43
44
    /**
45
     * @var NodeInterface[]
46
     *
47
     * @GraphQL\Field(type="[ID!]!", description="Array of nodes to search")
48
     */
49
    private $nodes = [];
50
51
    /**
52
     * @return null|string
53
     */
54 5
    public function getOp(): ?string
55
    {
56 5
        return $this->op;
57
    }
58
59
    /**
60
     * @param null|string $op
61
     */
62 3
    public function setOp(?string $op): void
63
    {
64 3
        $this->op = $op;
65 3
    }
66
67
    /**
68
     * @return NodeInterface[]
69
     */
70 5
    public function getNodes(): array
71
    {
72 5
        return $this->nodes;
73
    }
74
75
    /**
76
     * @param NodeInterface[] $nodes
77
     */
78 8
    public function setNodes(array $nodes): void
79
    {
80 8
        $this->nodes = $nodes;
81 8
    }
82
}
83