Code Duplication    Length = 19-20 lines in 2 locations

src/Phossa2/Storage/Driver/DriverAbstract.php 2 locations

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