GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( bb654b...bb17ca )
by Leonardo
03:48
created

OperationalFunctionalityModuleResolver   A

Complexity

Total Complexity 22

Size/Duplication

Total Lines 105
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 60
c 1
b 0
f 0
dl 0
loc 105
ccs 0
cts 42
cp 0
rs 10
wmc 22

6 Methods

Rating   Name   Duplication   Size   Complexity  
B getDescription() 0 17 7
A getName() 0 11 1
B getDependedModuleLists() 0 24 7
A getModulesToResolve() 0 9 1
A getModuleType() 0 3 1
A isEnabledByDefault() 0 10 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\ModuleResolvers;
6
7
use GraphQLAPI\GraphQLAPI\Plugin;
8
use GraphQLAPI\GraphQLAPI\ModuleResolvers\ModuleResolverTrait;
9
use GraphQLAPI\GraphQLAPI\ModuleTypeResolvers\ModuleTypeResolver;
10
11
class OperationalFunctionalityModuleResolver extends AbstractFunctionalityModuleResolver
12
{
13
    use ModuleResolverTrait;
14
15
    public const MULTIPLE_QUERY_EXECUTION = Plugin::NAMESPACE . '\multiple-query-execution';
16
    public const REMOVE_IF_NULL_DIRECTIVE = Plugin::NAMESPACE . '\remove-if-null-directive';
17
    public const PROACTIVE_FEEDBACK = Plugin::NAMESPACE . '\proactive-feedback';
18
    public const EMBEDDABLE_FIELDS = Plugin::NAMESPACE . '\embeddable-fields';
19
    public const MUTATIONS = Plugin::NAMESPACE . '\mutations';
20
    public const NESTED_MUTATIONS = Plugin::NAMESPACE . '\nested-mutations';
21
22
    /**
23
     * @return string[]
24
     */
25
    public static function getModulesToResolve(): array
26
    {
27
        return [
28
            self::MULTIPLE_QUERY_EXECUTION,
29
            self::REMOVE_IF_NULL_DIRECTIVE,
30
            self::PROACTIVE_FEEDBACK,
31
            self::EMBEDDABLE_FIELDS,
32
            self::MUTATIONS,
33
            self::NESTED_MUTATIONS,
34
        ];
35
    }
36
37
    /**
38
     * Enable to customize a specific UI for the module
39
     */
40
    public function getModuleType(string $module): string
41
    {
42
        return ModuleTypeResolver::OPERATIONAL;
43
    }
44
45
    /**
46
     * @return array<array> List of entries that must be satisfied, each entry is an array where at least 1 module must be satisfied
47
     */
48
    public function getDependedModuleLists(string $module): array
49
    {
50
        switch ($module) {
51
            case self::MULTIPLE_QUERY_EXECUTION:
52
                return [
53
                    [
54
                        EndpointFunctionalityModuleResolver::PERSISTED_QUERIES,
55
                        EndpointFunctionalityModuleResolver::SINGLE_ENDPOINT,
56
                        EndpointFunctionalityModuleResolver::CUSTOM_ENDPOINTS,
57
                    ],
58
                ];
59
            case self::REMOVE_IF_NULL_DIRECTIVE:
60
            case self::PROACTIVE_FEEDBACK:
61
            case self::EMBEDDABLE_FIELDS:
62
            case self::MUTATIONS:
63
                return [];
64
            case self::NESTED_MUTATIONS:
65
                return [
66
                    [
67
                        self::MUTATIONS,
68
                    ]
69
                ];
70
        }
71
        return parent::getDependedModuleLists($module);
72
    }
73
74
    public function getName(string $module): string
75
    {
76
        $names = [
77
            self::MULTIPLE_QUERY_EXECUTION => \__('Multiple Query Execution', 'graphql-api'),
78
            self::REMOVE_IF_NULL_DIRECTIVE => \__('Remove if Null', 'graphql-api'),
79
            self::PROACTIVE_FEEDBACK => \__('Proactive Feedback', 'graphql-api'),
80
            self::EMBEDDABLE_FIELDS => \__('Embeddable Fields', 'graphql-api'),
81
            self::MUTATIONS => \__('Mutations', 'graphql-api'),
82
            self::NESTED_MUTATIONS => \__('Nested Mutations', 'graphql-api'),
83
        ];
84
        return $names[$module] ?? $module;
85
    }
86
87
    public function getDescription(string $module): string
88
    {
89
        switch ($module) {
90
            case self::MULTIPLE_QUERY_EXECUTION:
91
                return \__('Execute multiple GraphQL queries in a single operation', 'graphql-api');
92
            case self::REMOVE_IF_NULL_DIRECTIVE:
93
                return \__('Addition of <code>@removeIfNull</code> directive, to remove an output from the response if it is <code>null</code>', 'graphql-api');
94
            case self::PROACTIVE_FEEDBACK:
95
                return \__('Usage of the top-level entry <code>extensions</code> to send deprecations, warnings, logs, notices and traces in the response to the query', 'graphql-api');
96
            case self::EMBEDDABLE_FIELDS:
97
                return \__('Embed the value of field into the argument of another field, via notation <code>{{ field }}</code>', 'graphql-api');
98
            case self::MUTATIONS:
99
                return \__('Modify data by executing mutations', 'graphql-api');
100
            case self::NESTED_MUTATIONS:
101
                return \__('Execute mutations from any type in the schema, not only from the root', 'graphql-api');
102
        }
103
        return parent::getDescription($module);
104
    }
105
106
    public function isEnabledByDefault(string $module): bool
107
    {
108
        switch ($module) {
109
            case self::MULTIPLE_QUERY_EXECUTION:
110
            case self::REMOVE_IF_NULL_DIRECTIVE:
111
            case self::EMBEDDABLE_FIELDS:
112
            case self::NESTED_MUTATIONS:
113
                return false;
114
        }
115
        return parent::isEnabledByDefault($module);
116
    }
117
}
118