Passed
Push — master ( 983377...eb5b2a )
by Petr
08:18
created

ProcessFile   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A readFile() 0 3 1
A copyFile() 0 3 1
A deleteFile() 0 3 1
A moveFile() 0 3 1
A saveFile() 0 3 1
1
<?php
2
3
namespace kalanis\kw_files\Processing\Storage;
4
5
6
use kalanis\kw_files\Interfaces\IFLTranslations;
7
use kalanis\kw_files\Interfaces\IProcessFiles;
8
use kalanis\kw_storage\Interfaces\IStorage;
9
10
11
/**
12
 * Class ProcessFile
13
 * @package kalanis\kw_files\Processing\Storage
14
 * Process files in many ways
15
 */
16
class ProcessFile implements IProcessFiles
17
{
18
    /** @var IProcessFiles */
19
    protected $adapter = null;
20
21 24
    public function __construct(IStorage $storage, ?IFLTranslations $lang = null)
22
    {
23 24
        $factory = new Files\Factory();
24 24
        $this->adapter = $factory->getClass($storage, $lang);
25
    }
26
27 8
    public function saveFile(array $entry, $content): bool
28
    {
29 8
        return $this->adapter->saveFile($entry, $content);
30
    }
31
32 8
    public function readFile(array $entry, ?int $offset = null, ?int $length = null)
33
    {
34 8
        return $this->adapter->readFile($entry, $offset, $length);
35
    }
36
37 4
    public function copyFile(array $source, array $dest): bool
38
    {
39 4
        return $this->adapter->copyFile($source, $dest);
40
    }
41
42 4
    public function moveFile(array $source, array $dest): bool
43
    {
44 4
        return $this->adapter->moveFile($source, $dest);
45
    }
46
47 4
    public function deleteFile(array $entry): bool
48
    {
49 4
        return $this->adapter->deleteFile($entry);
50
    }
51
}
52