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

Defaults::renderComponent()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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