CompositeAdapter::getStream()   A
last analyzed

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