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

StringComparisonExpression   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 getValue() 0 3 1
A setValue() 0 3 1
A setOp() 0 3 1
A getOp() 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\Type\StringComparisonOperatorType;
15
16
/**
17
 * @GraphQL\InputObjectType(
18
 *     description="Create string comparison expression to filter values by contents.
19
20
#### Example:
21
22
To select values containing given string:
23
````
24
value: 'Lorem Itsum'
25
````
26
27
or records starting with given string
28
````
29
op: STARTS_WITH
30
value: 'Lorem'
31
````
32
")
33
 */
34
class StringComparisonExpression
35
{
36
    /**
37
     * @var string|null
38
     *
39
     * @GraphQL\Field(type="StringComparisonOperator", description="Comparison operator, default value: `CONTAINS`")
40
     */
41
    private $op = StringComparisonOperatorType::EQUAL;
42
43
    /**
44
     * @var string|null
45
     *
46
     * @GraphQL\Field(type="string!", description="String value to search")
47
     */
48
    private $value;
49
50
    /**
51
     * @return null|string
52
     */
53 6
    public function getOp(): ?string
54
    {
55 6
        return $this->op;
56
    }
57
58
    /**
59
     * @param null|string $op
60
     */
61 5
    public function setOp(?string $op): void
62
    {
63 5
        $this->op = $op;
64 5
    }
65
66
    /**
67
     * @return null|string
68
     */
69 6
    public function getValue(): ?string
70
    {
71 6
        return $this->value;
72
    }
73
74
    /**
75
     * @param null|string $value
76
     */
77 8
    public function setValue(?string $value): void
78
    {
79 8
        $this->value = $value;
80 8
    }
81
}
82