Passed
Push — master ( 53c725...a8eb1b )
by Petr
07:45
created

Loader::getClassName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace kalanis\kw_modules\Loaders\Di;
4
5
6
use kalanis\kw_modules\Loaders\TSeparate;
7
8
9
/**
10
 * Class Loader
11
 * @package kalanis\kw_modules\Loaders
12
 * Load modules data from defined targets
13
 * Also use Dependency Injection
14
 * @codeCoverageIgnore contains external autoloader
15
 *
16
 * Paths:
17
 * /modules/{module_name}/php-src/{module_name}.php as init
18
 * /modules/{module_name}/php-src/Lib/* as next libraries
19
 * Namespaces:
20
 * \KWCMS\modules\{module_name}\{module_name} as init
21
 * \KWCMS\modules\{module_name}\Lib\ as next libraries
22
 *
23
 * Name is passed as first big and the rest little ( ucfirst(strtolower($x)) )
24
 * - lookup by curly braces
25
 */
26
class Loader extends ALoader
27
{
28
    use TSeparate;
29
30
    protected function getClassName(array $path): string
31
    {
32
        list($target, $constructPath) = $this->separateModule($path);
33
        return sprintf('\KWCMS\modules\%s\Controllers\%s', $target, $constructPath);
34
    }
35
}
36