Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

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