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

ProcessFile::findFreeName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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