Passed
Pull Request — master (#258)
by Dominik
05:19
created

Defaults::renderFile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 14
rs 9.9666
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Flynt;
4
5
use Flynt\ComponentManager;
6
7
class Defaults
8
{
9
    public static function init()
10
    {
11
        add_action('Flynt/registerComponent', ['Flynt\Defaults', 'loadFunctionsFile']);
12
    }
13
14
    public static function loadFunctionsFile($componentName)
15
    {
16
        $componentManager = ComponentManager::getInstance();
17
        $functionsFilePath = $componentManager->getComponentFilePath($componentName, 'functions.php');
18
        if (false !== $functionsFilePath) {
19
            require_once $functionsFilePath;
20
        }
21
    }
22
}
23