Code Duplication    Length = 5-5 lines in 2 locations

class/UploadHandler.php 2 locations

@@ 351-355 (lines=5) @@
348
        $file_path = $this->get_upload_path($file_name);
349
        if (!empty($version)) {
350
            $version_dir = $this->get_upload_path(null, $version);
351
            if (!is_dir($version_dir)) {
352
                if (!mkdir($version_dir, $this->options['mkdir_mode'], true) && !is_dir($version_dir)) {
353
                    throw new \RuntimeException(sprintf('Directory "%s" was not created', $version_dir));
354
                }
355
            }
356
            $new_file_path = $version_dir . '/' . $file_name;
357
        } else {
358
            $new_file_path = $file_path;
@@ 679-683 (lines=5) @@
676
        if ($this->validate($uploaded_file, $file, $error, $index)) {
677
            $this->handle_form_data($file, $index);
678
            $upload_dir = $this->get_upload_path();
679
            if (!is_dir($upload_dir)) {
680
                if (!mkdir($upload_dir, $this->options['mkdir_mode'], true) && !is_dir($upload_dir)) {
681
                    throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir));
682
                }
683
            }
684
            $file_path   = $this->get_upload_path($file->name);
685
            $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path);
686
            if ($uploaded_file && is_uploaded_file($uploaded_file)) {