Code Duplication    Length = 16-16 lines in 3 locations

src/Adapter/Ftp.php 1 location

@@ 22-37 (lines=16) @@
19
     *
20
     * @return bool
21
     */
22
    public function copy($path, $newpath)
23
    {
24
        $response = $this->readStream($path);
25
26
        if ($response === false || ! is_resource($response['stream'])) {
27
            return false;
28
        }
29
30
        $result = $this->writeStream($newpath, $response['stream'], new Config());
31
32
        if ($result !== false && is_resource($response['stream'])) {
33
            fclose($response['stream']);
34
        }
35
36
        return $result !== false;
37
    }
38
39
    /**
40
     * @var int

src/Adapter/NullAdapter.php 1 location

@@ 82-97 (lines=16) @@
79
        return $this->stream($path, $resource, $config, 'update');
80
    }
81
82
    public function copy($path, $newpath)
83
    {
84
        $response = $this->readStream($path);
85
86
        if ($response === false || ! is_resource($response['stream'])) {
87
            return false;
88
        }
89
90
        $result = $this->writeStream($newpath, $response['stream'], new Config());
91
92
        if ($result !== false && is_resource($response['stream'])) {
93
            fclose($response['stream']);
94
        }
95
96
        return $result !== false;
97
    }
98
99
    /**
100
     * Check whether a file is present.

src/Adapter/Polyfill/StreamedCopyTrait.php 1 location

@@ 17-32 (lines=16) @@
14
     *
15
     * @return bool
16
     */
17
    public function copy($path, $newpath)
18
    {
19
        $response = $this->readStream($path);
20
21
        if ($response === false || ! is_resource($response['stream'])) {
22
            return false;
23
        }
24
25
        $result = $this->writeStream($newpath, $response['stream'], new Config());
26
27
        if ($result !== false && is_resource($response['stream'])) {
28
            fclose($response['stream']);
29
        }
30
31
        return $result !== false;
32
    }
33
34
    // Required abstract method
35