CardDomains   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 10
c 1
b 0
f 0
dl 0
loc 17
ccs 13
cts 13
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Api\Field\Query;
6
7
use Application\Model\Card;
8
use Application\Model\Domain;
9
use Ecodev\Felix\Api\Field\FieldInterface;
10
use GraphQL\Type\Definition\Type;
11
12
abstract class CardDomains implements FieldInterface
13
{
14 1
    public static function build(): iterable
15
    {
16 1
        yield 'cardDomains' => fn () => [
17 1
            'type' => Type::nonNull(Type::listOf(Type::nonNull(_types()->getOutput(Domain::class)))),
18 1
            'args' => [
19 1
                [
20 1
                    'name' => 'filter',
21 1
                    'type' => _types()->getFilter(Card::class),
22 1
                ],
23 1
            ],
24 1
            'description' => 'List domains sorted by usage on cards filtered by given variables',
25 1
            'resolve' => function ($root, array $args): array {
26 1
                $qb = _types()->createFilteredQueryBuilder(Card::class, $args['filter'], []);
27
28 1
                return _em()->getRepository(Domain::class)->getByCards($qb);
29 1
            },
30 1
        ];
31
    }
32
}
33