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.

isWPConfigConstantDefined()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLAPI\GraphQLAPI\Config;
6
7
/**
8
 * Helpers for the Plugin configuration
9
 */
10
class PluginConfigurationHelpers
11
{
12
    /**
13
     * Determine if the environment variable was defined
14
     * as a constant in wp-config.php
15
     *
16
     * @return mixed
17
     */
18
    public static function getWPConfigConstantValue(string $envVariable)
19
    {
20
        return constant(self::getWPConfigConstantName($envVariable));
21
    }
22
23
    /**
24
     * Determine if the environment variable was defined
25
     * as a constant in wp-config.php
26
     */
27
    public static function isWPConfigConstantDefined(string $envVariable): bool
28
    {
29
        return defined(self::getWPConfigConstantName($envVariable));
30
    }
31
32
    /**
33
     * Constants defined in wp-config.php must start with this prefix
34
     * to override GraphQL API environment variables
35
     */
36
    public static function getWPConfigConstantName(string $envVariable): string
37
    {
38
        return 'GRAPHQL_API_' . $envVariable;
39
    }
40
}
41