Constants::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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