debug::get_debug()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 0
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
}