Failed Conditions
Push — master ( 27554e...857869 )
by Luca
09:08
created

CollectionCopyrights   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 76.92%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 17 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\Collection;
9
use Application\Repository\CollectionRepository;
10
use Ecodev\Felix\Api\Field\FieldInterface;
11
use GraphQL\Type\Definition\Type;
12
13
abstract class CollectionCopyrights implements FieldInterface
14
{
15 1
    public static function build(): array
16
    {
17 1
        return
18 1
            [
19 1
                'name' => 'collectionCopyrights',
20 1
                'type' => Type::nonNull(Type::string()),
21 1
                'description' => 'Returns the copyrights of given card',
22 1
                'args' => [
23 1
                    'card' => Type::nonNull(_types()->getId(Card::class)),
24 1
                ],
25 1
                'resolve' => function (array $root, array $args): string {
26
                    $card = $args['card']->getEntity();
27
28
                    /** @var CollectionRepository $collectionRepository */
29
                    $collectionRepository = _em()->getRepository(Collection::class);
30
31
                    return $collectionRepository->getCopyrights($card);
32 1
                },
33 1
            ];
34
    }
35
}
36