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

EditorResolverMap   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
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\User\Editor;
16
17
use Acme\App\Core\SharedKernel\Component\User\Domain\User\UserId;
18
use Acme\App\Presentation\Api\GraphQl\Node\User\AbstractUserViewModel;
19
use Acme\App\Presentation\Api\GraphQl\Node\User\Connection\CreatedPosts\CreatedPostsResolver;
20
use ArrayObject;
21
use GraphQL\Type\Definition\ResolveInfo;
22
use Overblog\GraphQLBundle\Definition\Argument;
23
use Overblog\GraphQLBundle\Resolver\ResolverMap as BaseResolverMap;
24
25
final class EditorResolverMap extends BaseResolverMap
26
{
27
    /**
28
     * @var CreatedPostsResolver
29
     */
30
    private $createdPostsResolver;
31
32
    public function __construct(CreatedPostsResolver $createdPostsResolver)
33
    {
34
        $this->createdPostsResolver = $createdPostsResolver;
35
    }
36
37
    protected function map(): array
38
    {
39
        return [
40
            'Editor' => [
41
                'createdPosts' => function (
42
                    AbstractUserViewModel $value,
43
                    Argument $args,
44
                    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...
45
                    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...
46
                ) {
47
                    return $this->createdPostsResolver->getCreatedPostsConnection(new UserId($args['id']));
48
                },
49
            ],
50
        ];
51
    }
52
}
53