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.

isHidden()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
ccs 0
cts 5
cp 0
crap 6
rs 10
c 0
b 0
f 0
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