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.

Constants   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
namespace BFW\Helpers;
4
5
use \Exception;
6
7
/**
8
 * Helpers to manage constants
9
 */
10
class Constants
11
{
12
    /**
13
     * @const ERR_ALREADY_DEFINED Exception code if the constant is already
14
     * defined.
15
     */
16
    const ERR_ALREADY_DEFINED = 1602001;
17
    
18
    /**
19
     * Create a new constant if not exist
20
     * 
21
     * @param string $cstName The constant's name
22
     * @param mixed $cstValue The constant's value
23
     * 
24
     * @return void
25
     * 
26
     * @throws \Exception If the constant is already defined
27
     */
28
    public static function create(string $cstName, $cstValue)
29
    {
30
        if (defined($cstName)) {
31
            throw new Exception(
32
                'The constant '.$cstName.' is already defined.',
33
                self::ERR_ALREADY_DEFINED
34
            );
35
        }
36
        
37
        define($cstName, $cstValue);
38
    }
39
}
40