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.

getDependedModuleLists()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 9
nc 3
nop 1
dl 0
loc 17
ccs 0
cts 8
cp 0
crap 12
rs 9.9666
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\ModuleResolvers;
6
7
use GraphQLAPI\GraphQLAPI\Plugin;
8
use GraphQLAPI\GraphQLAPI\Facades\ModuleRegistryFacade;
9
use GraphQLAPI\GraphQLAPI\ModuleResolvers\ModuleResolverTrait;
10
use GraphQLAPI\GraphQLAPI\ModuleResolvers\SchemaConfigurationFunctionalityModuleResolver;
11
use GraphQLAPI\GraphQLAPI\ModuleTypeResolvers\ModuleTypeResolver;
12
13
/**
14
 * The cache modules have different behavior depending on the environment:
15
 * - "development": visible, disabled by default
16
 * - "production": hidden, enabled by default
17
 *
18
 * @author Leonardo Losoviz <[email protected]>
19
 */
20
class CacheFunctionalityModuleResolver extends AbstractCacheFunctionalityModuleResolver
21
{
22
    use ModuleResolverTrait;
23
24
    public const CONFIGURATION_CACHE = Plugin::NAMESPACE . '\configuration-cache';
25
    public const SCHEMA_CACHE = Plugin::NAMESPACE . '\schema-cache';
26
27
    /**
28
     * @return string[]
29
     */
30
    public static function getModulesToResolve(): array
31
    {
32
        return [
33
            self::CONFIGURATION_CACHE,
34
            self::SCHEMA_CACHE,
35
        ];
36
    }
37
38
    /**
39
     * Enable to customize a specific UI for the module
40
     */
41
    public function getModuleType(string $module): string
42
    {
43
        return ModuleTypeResolver::PERFORMANCE;
44
    }
45
46
    /**
47
     * @return array<array> List of entries that must be satisfied, each entry is an array where at least 1 module must be satisfied
48
     */
49
    public function getDependedModuleLists(string $module): array
50
    {
51
        switch ($module) {
52
            case self::CONFIGURATION_CACHE:
53
                return [];
54
            case self::SCHEMA_CACHE:
55
                $moduleRegistry = ModuleRegistryFacade::getInstance();
56
                return [
57
                    [
58
                        self::CONFIGURATION_CACHE,
59
                    ],
60
                    [
61
                        $moduleRegistry->getInverseDependency(SchemaConfigurationFunctionalityModuleResolver::PUBLIC_PRIVATE_SCHEMA),
62
                    ],
63
                ];
64
        }
65
        return parent::getDependedModuleLists($module);
66
    }
67
68
    public function getName(string $module): string
69
    {
70
        $names = [
71
            self::CONFIGURATION_CACHE => \__('Configuration Cache', 'graphql-api'),
72
            self::SCHEMA_CACHE => \__('Schema Cache', 'graphql-api'),
73
        ];
74
        return $names[$module] ?? $module;
75
    }
76
77
    public function getDescription(string $module): string
78
    {
79
        switch ($module) {
80
            case self::CONFIGURATION_CACHE:
81
                return \__('Cache the generated application configuration to disk', 'graphql-api');
82
            case self::SCHEMA_CACHE:
83
                return \__('Cache the generated schema to disk', 'graphql-api');
84
        }
85
        return parent::getDescription($module);
86
    }
87
}
88