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;
@@ 677-681 (lines=5) @@
674
        if ($this->validate($uploaded_file, $file, $error, $index)) {
675
            $this->handle_form_data($file, $index);
676
            $upload_dir = $this->get_upload_path();
677
            if (!is_dir($upload_dir)) {
678
                if (!mkdir($upload_dir, $this->options['mkdir_mode'], true) && !is_dir($upload_dir)) {
679
                    throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir));
680
                }
681
            }
682
            $file_path   = $this->get_upload_path($file->name);
683
            $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path);
684
            if ($uploaded_file && is_uploaded_file($uploaded_file)) {