Test Setup Failed
Push — graphql_api ( 4ff753 )
by Herberto
07:48 queued 01:35
created

CommentResolverMap   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A map() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Explicit Architecture POC,
7
 * which is created on top of the Symfony Demo application.
8
 *
9
 * (c) Herberto Graça <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Acme\App\Presentation\Api\GraphQl\Node\Comment;
16
17
use Acme\App\Core\SharedKernel\Component\Blog\Domain\Post\Comment\CommentId;
18
use Acme\App\Presentation\Api\GraphQl\Node\Comment\Connection\Author\CommentAuthorsResolver;
19
use ArrayObject;
20
use GraphQL\Type\Definition\ResolveInfo;
21
use Overblog\GraphQLBundle\Definition\Argument;
22
use Overblog\GraphQLBundle\Resolver\ResolverMap as BaseResolverMap;
23
24
final class CommentResolverMap extends BaseResolverMap
25
{
26
    /**
27
     * @var CommentAuthorsResolver
28
     */
29
    private $commentAuthorsResolver;
30
31
    public function __construct(CommentAuthorsResolver $commentAuthorsResolver)
32
    {
33
        $this->commentAuthorsResolver = $commentAuthorsResolver;
34
    }
35
36
    protected function map(): array
37
    {
38
        return [
39
            'Comment' => [
40
                'authors' => function (
41
                    CommentViewModel $value,
42
                    Argument $args,
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
                    ArrayObject $context,
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
                    ResolveInfo $info
0 ignored issues
show
Unused Code introduced by
The parameter $info is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
                ) {
46
                    return $this->commentAuthorsResolver->getCommentAuthorsConnection(new CommentId($value->getId()));
47
                },
48
            ],
49
        ];
50
    }
51
}
52