Passed
Pull Request — master (#3)
by De Cramer
02:12
created

ProxySubFileSystem::deleteDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Oliverde8\Component\PhpEtl\Model\File;
4
5
class ProxySubFileSystem implements FileSystemInterface
6
{
7
    protected $subDir;
8
9
    protected FileSystemInterface $fileSystem;
10
11
    /**
12
     * @param $subDir
13
     * @param FileSystemInterface $fileSystem
14
     */
15
    public function __construct($subDir, FileSystemInterface $fileSystem)
16
    {
17
        $this->subDir = "/" . trim($subDir, "/") . "/";
18
        $this->fileSystem = $fileSystem;
19
    }
20
21
    public function getRootPath(): string
22
    {
23
        return $this->fileSystem->getRootPath() . $this->subDir;
24
    }
25
26
    public function fileExists(string $path): bool
27
    {
28
        return $this->fileSystem->fileExists($this->subDir . $path);
29
    }
30
31
    public function write(string $path, string $contents, array $config = []): void
32
    {
33
        $this->fileSystem->write($this->subDir . $path, $contents, $config);
34
    }
35
36
    public function writeStream(string $path, $contents, array $config = []): void
37
    {
38
        $this->fileSystem->writeStream($this->subDir . $path, $contents, $config);
39
    }
40
41
    public function read(string $path): string
42
    {
43
        return $this->fileSystem->read($this->subDir . $path);
44
    }
45
46
    public function readStream(string $path)
47
    {
48
        return $this->fileSystem->readStream($this->subDir . $path);
49
    }
50
51
    public function delete(string $path): void
52
    {
53
        $this->fileSystem->delete($this->subDir . $path);
54
    }
55
56
    public function deleteDirectory(string $path): void
57
    {
58
        $this->fileSystem->deleteDirectory($this->subDir . $path);
59
    }
60
61
    public function createDirectory(string $path, array $config = []): void
62
    {
63
        $this->fileSystem->createDirectory($this->subDir . $path, $config);
64
    }
65
66
    public function listContents(string $path): array
67
    {
68
        return $this->fileSystem->listContents($this->subDir . $path);
69
    }
70
71
    public function move(string $source, string $destination, array $config = [])
72
    {
73
        $this->fileSystem->move($this->subDir . $source, $this->subDir . $destination, $config);
74
    }
75
76
    public function copy(string $source, string $destination, array $config = [])
77
    {
78
        $this->fileSystem->copy($this->subDir . $source, $this->subDir . $destination, $config);
79
    }
80
}