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.

AbstractCacheFunctionalityModuleResolver   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 36
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A enabledEnvironmentBasedBehavior() 0 3 1
A isEnabledByDefault() 0 7 2
A getModuleType() 0 3 1
A isHidden() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\ModuleResolvers;
6
7
use GraphQLAPI\GraphQLAPI\PluginEnvironment;
8
use GraphQLAPI\GraphQLAPI\ModuleTypeResolvers\ModuleTypeResolver;
9
10
/**
11
 * The cache modules have different behavior depending on the environment:
12
 * - "development": visible, disabled by default
13
 * - "production": hidden, enabled by default
14
 *
15
 * @author Leonardo Losoviz <[email protected]>
16
 */
17
abstract class AbstractCacheFunctionalityModuleResolver extends AbstractFunctionalityModuleResolver
18
{
19
    /**
20
     * Enable to customize a specific UI for the module
21
     */
22
    public function getModuleType(string $module): string
23
    {
24
        return ModuleTypeResolver::PERFORMANCE;
25
    }
26
27
    /**
28
     * Allow to change the behavior based on the environment
29
     *
30
     * @return boolean
31
     */
32
    protected function enabledEnvironmentBasedBehavior(): bool
33
    {
34
        return false;
35
    }
36
37
    public function isHidden(string $module): bool
38
    {
39
        if ($this->enabledEnvironmentBasedBehavior()) {
40
            $environment = PluginEnvironment::getPluginEnvironment();
41
            return $environment == PluginEnvironment::PLUGIN_ENVIRONMENT_PROD;
42
        }
43
        return parent::isHidden($module);
44
    }
45
46
    public function isEnabledByDefault(string $module): bool
47
    {
48
        if ($this->enabledEnvironmentBasedBehavior()) {
49
            $environment = PluginEnvironment::getPluginEnvironment();
50
            return $environment == PluginEnvironment::PLUGIN_ENVIRONMENT_PROD;
51
        }
52
        return parent::isEnabledByDefault($module);
53
    }
54
}
55