Code Duplication    Length = 5-5 lines in 2 locations

class/UploadHandler.php 2 locations

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