Factory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 20
ccs 9
cts 9
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDrivingFile() 0 11 1
1
<?php
2
3
namespace kalanis\UploadPerPartes\Target\Local\DrivingFile;
4
5
6
use kalanis\UploadPerPartes\Traits\TLangInit;
7
use kalanis\UploadPerPartes\Uploader\Config;
8
use kalanis\UploadPerPartes\UploadException;
9
10
11
/**
12
 * Class Factory
13
 * @package kalanis\UploadPerPartes\Target\Local\DrivingFile
14
 * Which driving file configuration will be used
15
 */
16
class Factory
17
{
18
    use TLangInit;
19
20
    /**
21
     * @param Config $config
22
     * @throws UploadException
23
     * @return DrivingFile
24
     */
25 20
    public function getDrivingFile(Config $config): DrivingFile
26
    {
27 20
        $storage = (new Storage\Factory($this->getUppLang()))->getStorage($config);
28 20
        $keyEncoder = (new KeyEncoders\Factory($this->getUppLang()))->getKeyEncoder($config);
29 20
        $storage->checkKeyEncoder($keyEncoder);
30 20
        return new DrivingFile(
31 20
            $storage,
32
            $keyEncoder,
33 20
            (new KeyModifiers\Factory($this->getUppLang()))->getKeyModifier($config->keyModifier),
34 20
            (new DataEncoders\Factory($this->getUppLang()))->getDataEncoder($config),
35 20
            (new DataModifiers\Factory($this->getUppLang()))->getDataModifier($config->dataModifier)
36
        );
37
    }
38
}
39