Code Duplication    Length = 5-5 lines in 2 locations

class/UploadHandler.php 2 locations

@@ 336-340 (lines=5) @@
333
        $file_path = $this->get_upload_path($file_name);
334
        if (!empty($version)) {
335
            $version_dir = $this->get_upload_path(null, $version);
336
            if (!is_dir($version_dir)) {
337
                if (!mkdir($version_dir, $this->options['mkdir_mode'], true) && !is_dir($version_dir)) {
338
                    throw new \RuntimeException(sprintf('Directory "%s" was not created', $version_dir));
339
                }
340
            }
341
            $new_file_path = $version_dir . '/' . $file_name;
342
        } else {
343
            $new_file_path = $file_path;
@@ 646-650 (lines=5) @@
643
        if ($this->validate($uploaded_file, $file, $error, $index)) {
644
            $this->handle_form_data($file, $index);
645
            $upload_dir = $this->get_upload_path();
646
            if (!is_dir($upload_dir)) {
647
                if (!mkdir($upload_dir, $this->options['mkdir_mode'], true) && !is_dir($upload_dir)) {
648
                    throw new \RuntimeException(sprintf('Directory "%s" was not created', $upload_dir));
649
                }
650
            }
651
            $file_path   = $this->get_upload_path($file->name);
652
            $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path);
653
            if ($uploaded_file && is_uploaded_file($uploaded_file)) {