Code Duplication    Length = 19-20 lines in 2 locations

src/Storage/Driver/DriverAbstract.php 2 locations

@@ 144-163 (lines=20) @@
141
    /**
142
     * {@inheritDoc}
143
     */
144
    public function rename(/*# string */ $from, /*# string */ $to)/*# : bool */
145
    {
146
        $real_to = $this->realPath($to);
147
148
        if ($this->ensurePath($real_to)) {
149
            $real_from = $this->realPath($from);
150
151
            if ($this->isRealDir($real_from)) {
152
                $res = $this->renameDir($real_from, $real_to);
153
            } else {
154
                $res = $this->renameFile($real_from, $real_to);
155
            }
156
157
            return $res ?: $this->setError(
158
                Message::get(Message::STR_RENAME_FAIL, $real_from, $real_to),
159
                Message::STR_RENAME_FAIL
160
            );
161
        }
162
        return false;
163
    }
164
165
    /**
166
     * {@inheritDoc}
@@ 168-186 (lines=19) @@
165
    /**
166
     * {@inheritDoc}
167
     */
168
    public function copy(/*# string */ $from, /*# string */ $to)/*# : bool */
169
    {
170
        $real_from = $this->realPath($from);
171
        $real_to = $this->realPath($to);
172
173
        if ($this->ensurePath($real_to)) {
174
            if ($this->isRealDir($real_from)) {
175
                $res = $this->copyDir($real_from, $real_to);
176
            } else {
177
                $res = $this->copyFile($real_from, $real_to);
178
            }
179
180
            return $res ?: $this->setError(
181
                Message::get(Message::STR_COPY_FAIL, $real_from, $real_to),
182
                Message::STR_COPY_FAIL
183
            );
184
        }
185
        return false;
186
    }
187
188
    /**
189
     * {@inheritDoc}