Passed
Push — master ( 399339...9c419c )
by Petr
08:15
created

CompositeAdapter::readFileStream()   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 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace kalanis\kw_files\Access;
4
5
6
use kalanis\kw_files\Interfaces;
7
8
9
/**
10
 * Class CompositeAdapter
11
 * @package kalanis\kw_files\Access
12
 * Pass work with files in storage in one class
13
 */
14
class CompositeAdapter implements Interfaces\IProcessNodes, Interfaces\IProcessDirs, Interfaces\IProcessFiles, Interfaces\IProcessFileStreams
15
{
16
    protected Interfaces\IProcessNodes $libNode;
17
    protected Interfaces\IProcessDirs $libDir;
18
    protected Interfaces\IProcessFiles $libFile;
19
    protected Interfaces\IProcessFileStreams $libStream;
20
21 12
    public function __construct(
22
        Interfaces\IProcessNodes $libNode,
23
        Interfaces\IProcessDirs $libDir,
24
        Interfaces\IProcessFiles $libFile,
25
        Interfaces\IProcessFileStreams $libStream
26
    )
27
    {
28 12
        $this->libNode = $libNode;
29 12
        $this->libDir = $libDir;
30 12
        $this->libFile = $libFile;
31 12
        $this->libStream = $libStream;
32 12
    }
33
34 6
    public function createDir(array $entry, bool $deep = false): bool
35
    {
36 6
        return $this->libDir->createDir($entry, $deep);
37
    }
38
39 1
    public function readDir(array $entry, bool $loadRecursive = false, bool $wantSize = false): array
40
    {
41 1
        return $this->libDir->readDir($entry, $loadRecursive, $wantSize);
42
    }
43
44 1
    public function copyDir(array $source, array $dest): bool
45
    {
46 1
        return $this->libDir->copyDir($source, $dest);
47
    }
48
49 1
    public function moveDir(array $source, array $dest): bool
50
    {
51 1
        return $this->libDir->moveDir($source, $dest);
52
    }
53
54 2
    public function deleteDir(array $entry, bool $deep = false): bool
55
    {
56 2
        return $this->libDir->deleteDir($entry, $deep);
57
    }
58
59 5
    public function saveFile(array $entry, string $content, ?int $offset = null, int $mode = 0): bool
60
    {
61 5
        return $this->libFile->saveFile($entry, $content, $offset);
62
    }
63
64 1
    public function readFile(array $entry, ?int $offset = null, ?int $length = null): string
65
    {
66 1
        return $this->libFile->readFile($entry, $offset, $length);
67
    }
68
69 1
    public function copyFile(array $source, array $dest): bool
70
    {
71 1
        return $this->libFile->copyFile($source, $dest);
72
    }
73
74 1
    public function moveFile(array $source, array $dest): bool
75
    {
76 1
        return $this->libFile->moveFile($source, $dest);
77
    }
78
79 1
    public function deleteFile(array $entry): bool
80
    {
81 1
        return $this->libFile->deleteFile($entry);
82
    }
83
84 1
    public function saveFileStream(array $entry, $content, int $mode = 0): bool
85
    {
86 1
        return $this->libStream->saveFileStream($entry, $content, $mode);
87
    }
88
89 1
    public function readFileStream(array $entry)
90
    {
91 1
        return $this->libStream->readFileStream($entry);
92
    }
93
94 1
    public function copyFileStream(array $source, array $dest): bool
95
    {
96 1
        return $this->libStream->copyFileStream($source, $dest);
97
    }
98
99 1
    public function moveFileStream(array $source, array $dest): bool
100
    {
101 1
        return $this->libStream->moveFileStream($source, $dest);
102
    }
103
104 6
    public function exists(array $entry): bool
105
    {
106 6
        return $this->libNode->exists($entry);
107
    }
108
109 1
    public function isReadable(array $entry): bool
110
    {
111 1
        return $this->libNode->isReadable($entry);
112
    }
113
114 1
    public function isWritable(array $entry): bool
115
    {
116 1
        return $this->libNode->isWritable($entry);
117
    }
118
119 6
    public function isDir(array $entry): bool
120
    {
121 6
        return $this->libNode->isDir($entry);
122
    }
123
124 2
    public function isFile(array $entry): bool
125
    {
126 2
        return $this->libNode->isFile($entry);
127
    }
128
129 1
    public function size(array $entry): ?int
130
    {
131 1
        return $this->libNode->size($entry);
132
    }
133
134 1
    public function created(array $entry): ?int
135
    {
136 1
        return $this->libNode->created($entry);
137
    }
138
139 1
    public function getNode(): Interfaces\IProcessNodes
140
    {
141 1
        return $this->libNode;
142
    }
143
144 1
    public function getDir(): Interfaces\IProcessDirs
145
    {
146 1
        return $this->libDir;
147
    }
148
149 1
    public function getFile(): Interfaces\IProcessFiles
150
    {
151 1
        return $this->libFile;
152
    }
153
154 1
    public function getStream(): Interfaces\IProcessFileStreams
155
    {
156 1
        return $this->libStream;
157
    }
158
}
159