Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
AppConfig
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
1 / 1
 setProjectRoot
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
 unsetProjectRoot
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getProjectRoot
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @author: Doug Wilbourne (dougwilbourne@gmail.com)
5 */
6
7declare(strict_types=1);
8
9namespace pvc\config;
10
11use pvc\config\err\InvalidProjectRootException;
12use pvc\interfaces\config\AppConfigInterface;
13
14/**
15 * Class AppConfig
16 */
17class AppConfig implements AppConfigInterface
18{
19    protected static string $project_root = '';
20
21    public static function setProjectRoot(string $dirName): void
22    {
23        if (!is_dir($dirName)) {
24            throw new InvalidProjectRootException($dirName);
25        }
26        self::$project_root = $dirName;
27    }
28
29    public static function unsetProjectRoot(): void
30    {
31        self::$project_root = '';
32    }
33
34    public static function getProjectRoot(): string
35    {
36        return self::$project_root;
37    }
38}