Code Duplication    Length = 15-15 lines in 2 locations

src/Storage/Driver/LocalDriver.php 2 locations

@@ 148-162 (lines=15) @@
145
    /**
146
     * {@inheritDoc}
147
     */
148
    protected function writeStream(
149
        /*# string */ $realPath,
150
        $resource
151
    )/*# : bool */ {
152
        $tmpfname = tempnam(dirname($realPath), 'FOO');
153
        if (false !== $tmpfname) {
154
            $stream = fopen($tmpfname, 'w+b');
155
            if (is_resource($stream)) {
156
                stream_copy_to_stream($resource, $stream);
157
                fclose($stream);
158
                return $this->renameTempFile($tmpfname, $realPath);
159
            }
160
        }
161
        return false;
162
    }
163
164
    /**
165
     * {@inheritDoc}
@@ 167-181 (lines=15) @@
164
    /**
165
     * {@inheritDoc}
166
     */
167
    protected function writeFile(
168
        /*# string */ $realPath,
169
        /*# string */ $content
170
    )/*# : bool */ {
171
        // write to a temp file
172
        $tmpfname = tempnam(dirname($realPath), 'FOO');
173
        if (false !== $tmpfname) {
174
            $handle = fopen($tmpfname, 'w');
175
            fwrite($handle, $content);
176
            fclose($handle);
177
178
            return $this->renameTempFile($tmpfname, $realPath);
179
        }
180
        return false;
181
    }
182
183
    /**
184
     * {@inheritDoc}