Constants   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A __invoke() 0 3 1
A obtainRootDir() 0 5 1
1
<?php
2
3
namespace BFW\Core\AppSystems;
4
5
class Constants extends AbstractSystem
6
{
7
    /**
8
     * Define all constants
9
     */
10
    public function __construct()
11
    {
12
        \BFW\Helpers\Constants::create('ROOT_DIR', $this->obtainRootDir());
13
14
        \BFW\Helpers\Constants::create('APP_DIR', ROOT_DIR.'app/');
15
        \BFW\Helpers\Constants::create('SRC_DIR', ROOT_DIR.'src/');
16
        \BFW\Helpers\Constants::create('WEB_DIR', ROOT_DIR.'web/');
17
18
        \BFW\Helpers\Constants::create('CONFIG_DIR', APP_DIR.'config/');
19
        \BFW\Helpers\Constants::create('MODULES_DIR', APP_DIR.'modules/');
20
        
21
        \BFW\Helpers\Constants::create('MODULES_AVAILABLE_DIR', MODULES_DIR.'available/');
0 ignored issues
show
Bug introduced by
The constant BFW\Core\AppSystems\MODULES_DIR was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
22
        \BFW\Helpers\Constants::create('MODULES_ENABLED_DIR', MODULES_DIR.'enabled/');
23
    }
24
    
25
    /**
26
     * {@inheritdoc}
27
     * @return null
28
     */
29
    public function __invoke()
30
    {
31
        return null;
32
    }
33
    
34
    /**
35
     * Obtain the path of the application root directory
36
     * 
37
     * @return string
38
     */
39
    protected function obtainRootDir(): string
40
    {
41
        return \BFW\Application::getInstance()
42
            ->getOptions()
43
            ->getValue('rootDir')
44
        ;
45
    }
46
}
47