Filter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 5
rs 10
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQL\Doctrine\Attribute;
6
7
use Attribute;
8
use GraphQL\Doctrine\Definition\Operator\AbstractOperator;
9
10
/**
11
 * Attribute used to define custom filter.
12
 */
13
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
14
final class Filter implements ApiAttribute
15
{
16
    /**
17
     * @param string $field Name of the field on which to apply the operator.
18
     *
19
     * The field may or may not actually exist in the entity. It is merely used
20
     * to organize the filter correctly in the API.
21
     * @param class-string<AbstractOperator> $operator FQCN to the PHP class implementing the GraphQL operator
22
     * @param string $type GraphQL leaf type name of the type of the field
23
     */
24 18
    public function __construct(
25
        public readonly string $field,
26
        public readonly string $operator,
27
        public readonly string $type,
28
    ) {
29 18
    }
30
}
31