Factory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 1
b 0
f 0
ccs 6
cts 6
cp 1
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 10 3
1
<?php
2
3
namespace kalanis\kw_files\Processing\Storage\Dirs;
4
5
6
use kalanis\kw_files\Interfaces\IFLTranslations;
7
use kalanis\kw_storage\Interfaces;
8
9
10
/**
11
 * Class Factory
12
 * @package kalanis\kw_files\Processing\Storage\Dirs
13
 * Process dirs in storages - get correct one
14
 */
15
class Factory
16
{
17 83
    public function getClass(Interfaces\IStorage $storage, ?IFLTranslations $lang = null): ADirs
18
    {
19 83
        if ($storage instanceof Interfaces\IPassDirs) {
20 50
            if ($storage->isFlat()) {
21 23
                return new CanDirFlat($storage);
22
            } else {
23 27
                return new CanDirRecursive($storage, $lang);
24
            }
25
        } else {
26 33
            return new Basic($storage, $lang);
27
        }
28
    }
29
}
30