Passed
Push — master ( 68bc04...2d5d0a )
by Adrien
02:23
created

EnumType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Api\Enum;
6
7
abstract class EnumType extends \GraphQL\Type\Definition\EnumType
8
{
9
    public function __construct(array $constants)
10
    {
11
        $values = [];
12
        foreach ($constants as $key => $description) {
13
            $values[$key] = [
14
                'value' => $key,
15
                'description' => $description,
16
            ];
17
        }
18
19
        $config = [
20
            'values' => $values,
21
        ];
22
23
        parent::__construct($config);
24
    }
25
}
26