Passed
Pull Request — master (#30)
by De Cramer
08:52
created

FlySystemFileSystem::__construct()   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
declare(strict_types=1);
3
4
namespace Oliverde8\Component\PhpEtl\Model\File;
5
6
use League\Flysystem\Filesystem;
0 ignored issues
show
Bug introduced by
The type League\Flysystem\Filesystem was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class FlySystemFileSystem implements FileSystemInterface
9
{
10
    protected Filesystem $filesystem;
11
12
    /**
13
     * @param Filesystem $filesystem
14
     */
15
    public function __construct(Filesystem $filesystem)
16
    {
17
        $this->filesystem = $filesystem;
18
    }
19
20
    public function getRootPath(): string
21
    {
22
        return "/";
23
    }
24
25
    public function fileExists(string $path): bool
26
    {
27
        return $this->filesystem->fileExists($path);
28
    }
29
30
    public function write(string $path, string $contents, array $config = []): void
31
    {
32
        $this->filesystem->write($path, $contents, $config);
33
    }
34
35
    public function writeStream(string $path, $contents, array $config = []): void
36
    {
37
        $this->filesystem->writeStream($path, $contents, $config);
38
    }
39
40
    public function read(string $path): string
41
    {
42
        return $this->filesystem->read($path);
43
    }
44
45
    public function readStream(string $path)
46
    {
47
        return $this->filesystem->readStream($path);
48
    }
49
50
    public function delete(string $path): void
51
    {
52
       $this->filesystem->delete($path);
53
    }
54
55
    public function deleteDirectory(string $path): void
56
    {
57
        $this->filesystem->deleteDirectory($path);
58
    }
59
60
    public function createDirectory(string $path, array $config = []): void
61
    {
62
        $this->filesystem->createDirectory($path, $config);
63
    }
64
65
    public function listContents(string $path): array
66
    {
67
        $listing = $this->filesystem->listContents($path);
68
        return $listing->toArray();
69
    }
70
71
    public function move(string $source, string $destination, array $config = [])
72
    {
73
        $this->filesystem->move($source, $destination, $config);
74
    }
75
76
    public function copy(string $source, string $destination, array $config = [])
77
    {
78
        $this->filesystem->copy($source, $destination, $config);
79
    }
80
}
81