Code Duplication    Length = 18-20 lines in 3 locations

src/StorageAdapter/FlysystemStorageAdapter.php 3 locations

@@ 22-39 (lines=18) @@
19
        $this->filesystem = $filesystem;
20
    }
21
22
    public function writeStream(string $relativePath, $stream)
23
    {
24
        $this->logger->debug("Writing stream to {$relativePath}...");
25
26
        try
27
        {
28
            $success = $this->filesystem->putStream($relativePath, $stream);
29
30
            if (!$success)
31
            {
32
                throw new Exception(sprintf('writeStream() failed for %s.', $relativePath));
33
            }
34
        }
35
        catch (\Exception $exception)
36
        {
37
            throw new Exception($exception->getMessage(), 0, $exception);
38
        }
39
    }
40
41
    public function exists(string $relativePath): bool
42
    {
@@ 53-70 (lines=18) @@
50
        }
51
    }
52
53
    public function unlink(string $relativePath)
54
    {
55
        $this->logger->debug("Deleting {$relativePath}...");
56
57
        try
58
        {
59
            $success = $this->filesystem->delete($relativePath);
60
61
            if (!$success)
62
            {
63
                throw new Exception(sprintf('unlink() failed for %s', $relativePath));
64
            }
65
        }
66
        catch (\Exception $exception)
67
        {
68
            throw new Exception($exception->getMessage(), 0, $exception);
69
        }
70
    }
71
72
    public function getReadStream(string $relativePath)
73
    {
@@ 72-91 (lines=20) @@
69
        }
70
    }
71
72
    public function getReadStream(string $relativePath)
73
    {
74
        $this->logger->debug("Getting read stream for {$relativePath}...");
75
76
        try
77
        {
78
            $stream = $this->filesystem->readStream($relativePath);
79
80
            if (!is_resource($stream))
81
            {
82
                throw new Exception(sprintf('getReadStream() failed for %s.', $relativePath));
83
            }
84
85
            return $stream;
86
        }
87
        catch (\Exception $exception)
88
        {
89
            throw new Exception($exception->getMessage(), 0, $exception);
90
        }
91
    }
92
}
93