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 ( 008b28...1ac17a )
by Leonardo
03:09
created

CacheFunctionalityModuleResolver   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 27
dl 0
loc 60
ccs 0
cts 46
cp 0
rs 10
c 2
b 0
f 0
wmc 9

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getModulesToResolve() 0 5 1
A getDescription() 0 9 3
A getDependedModuleLists() 0 17 3
A getName() 0 7 1
A getModuleType() 0 3 1
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
    public static function getModulesToResolve(): array
28
    {
29
        return [
30
            self::CONFIGURATION_CACHE,
31
            self::SCHEMA_CACHE,
32
        ];
33
    }
34
35
    /**
36
     * Enable to customize a specific UI for the module
37
     */
38
    public function getModuleType(string $module): string
39
    {
40
        return ModuleTypeResolver::PERFORMANCE;
41
    }
42
43
    public function getDependedModuleLists(string $module): array
44
    {
45
        switch ($module) {
46
            case self::CONFIGURATION_CACHE:
47
                return [];
48
            case self::SCHEMA_CACHE:
49
                $moduleRegistry = ModuleRegistryFacade::getInstance();
50
                return [
51
                    [
52
                        self::CONFIGURATION_CACHE,
53
                    ],
54
                    [
55
                        $moduleRegistry->getInverseDependency(SchemaConfigurationFunctionalityModuleResolver::PUBLIC_PRIVATE_SCHEMA),
56
                    ],
57
                ];
58
        }
59
        return parent::getDependedModuleLists($module);
60
    }
61
62
    public function getName(string $module): string
63
    {
64
        $names = [
65
            self::CONFIGURATION_CACHE => \__('Configuration Cache', 'graphql-api'),
66
            self::SCHEMA_CACHE => \__('Schema Cache', 'graphql-api'),
67
        ];
68
        return $names[$module] ?? $module;
69
    }
70
71
    public function getDescription(string $module): string
72
    {
73
        switch ($module) {
74
            case self::CONFIGURATION_CACHE:
75
                return \__('Cache the generated application configuration to disk', 'graphql-api');
76
            case self::SCHEMA_CACHE:
77
                return \__('Cache the generated schema to disk', 'graphql-api');
78
        }
79
        return parent::getDescription($module);
80
    }
81
}
82