Completed
Pull Request — master (#13)
by Rafael
06:46
created

SubscriptionType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 20
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 2
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Type;
12
13
/**
14
 * Class SubscriptionType
15
 */
16
class SubscriptionType extends QueryType
17
{
18
    /**
19
     * @param array $config
20
     */
21
    public function __construct(array $config = [])
22
    {
23
        $defaults = [
24
            'name' => 'Subscription',
25
            'fields' => function () {
26
                $subscriptions = [];
27
                foreach ($this->endpoint->allSubscriptions() as $subscription) {
28
                    $subscriptions[$subscription->getName()] = $this->getQueryConfig($subscription);
29
                }
30
31
                return $subscriptions;
32
            },
33
        ];
34
35
        parent::__construct(array_merge($defaults, $config));
36
    }
37
}
38