debug   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 13
dl 0
loc 22
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set_debug() 0 9 3
A get_debug() 0 5 2
1
<?php
2
3
/**
4
 * © 2018 - Phoponent
5
 * Author: Nicolas Choquet
6
 * Email: [email protected]
7
 * LICENSE GPL ( GNU General Public License )
8
 */
9
10
namespace phoponent\framework\static_classe;
11
12
use phoponent\framework\traits\static_class;
13
14
class debug {
15
    use static_class;
16
    const TRUE = '1', FALSE = '0';
17
    private static $file_path = 'phoponent/framework/debug.info';
18
19
    public static function set_debug() {
20
        if(!is_file(self::$file_path)) {
21
            file_put_contents(self::$file_path, self::FALSE);
22
        }
23
        if((integer)file_get_contents(self::$file_path) === 1) {
24
            file_put_contents(self::$file_path, self::FALSE);
25
        }
26
        else {
27
            file_put_contents(self::$file_path, self::TRUE);
28
        }
29
    }
30
31
    public static function get_debug(): bool {
32
        if(!is_file(self::$file_path)) {
33
            file_put_contents(self::$file_path, self::FALSE);
34
        }
35
        return (boolean)(integer)file_get_contents(self::$file_path);
36
    }
37
}