ProcessFile   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A readFile() 0 3 1
A copyFile() 0 3 1
A __construct() 0 4 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
    protected IProcessFiles $adapter;
19
20 38
    public function __construct(IStorage $storage, ?IFLTranslations $lang = null)
21
    {
22 38
        $factory = new Files\Factory();
23 38
        $this->adapter = $factory->getClass($storage, $lang);
24
    }
25
26 17
    public function saveFile(array $entry, string $content, ?int $offset = null, int $mode = 0): bool
27
    {
28 17
        return $this->adapter->saveFile($entry, $content, $offset, $mode);
29
    }
30
31 12
    public function readFile(array $entry, ?int $offset = null, ?int $length = null): string
32
    {
33 12
        return $this->adapter->readFile($entry, $offset, $length);
34
    }
35
36 5
    public function copyFile(array $source, array $dest): bool
37
    {
38 5
        return $this->adapter->copyFile($source, $dest);
39
    }
40
41 7
    public function moveFile(array $source, array $dest): bool
42
    {
43 7
        return $this->adapter->moveFile($source, $dest);
44
    }
45
46 4
    public function deleteFile(array $entry): bool
47
    {
48 4
        return $this->adapter->deleteFile($entry);
49
    }
50
}
51