Code Duplication    Length = 17-18 lines in 2 locations

system/modules/Ui/objects/ActiveForm/Input/File.php 1 location

@@ 16-32 (lines=17) @@
13
14
class File extends \Ui\ActiveForm\Input {
15
16
  public function parseRequest($request) {
17
    if (!empty($_FILES[$this->activeForm->requestFormName]['tmp_name'][$this->modelName][$this->colName])) {
18
      $file_id = \App::$primary->files->upload([
19
          'tmp_name' => $_FILES[$this->activeForm->requestFormName]['tmp_name'][$this->modelName][$this->colName],
20
          'name' => $_FILES[$this->activeForm->requestFormName]['name'][$this->modelName][$this->colName],
21
          'type' => $_FILES[$this->activeForm->requestFormName]['type'][$this->modelName][$this->colName],
22
          'size' => $_FILES[$this->activeForm->requestFormName]['size'][$this->modelName][$this->colName],
23
          'error' => $_FILES[$this->activeForm->requestFormName]['error'][$this->modelName][$this->colName],
24
              ], [
25
          'upload_code' => 'activeForm:' . $this->activeForm->modelName . ':' . $this->activeForm->model->pk()
26
      ]);
27
28
      if ($file_id) {
29
        $this->activeForm->model->{$this->colName} = $file_id;
30
      }
31
    }
32
  }
33
34
}
35

system/modules/Ui/objects/ActiveForm/Input/Image.php 1 location

@@ 37-54 (lines=18) @@
34
        return true;
35
    }
36
37
    public function parseRequest($request)
38
    {
39
        if (!empty($_FILES[$this->activeForm->requestFormName]['tmp_name'][$this->modelName][$this->colName])) {
40
            $file_id = \App::$primary->files->upload([
41
                'tmp_name' => $_FILES[$this->activeForm->requestFormName]['tmp_name'][$this->modelName][$this->colName],
42
                'name' => $_FILES[$this->activeForm->requestFormName]['name'][$this->modelName][$this->colName],
43
                'type' => $_FILES[$this->activeForm->requestFormName]['type'][$this->modelName][$this->colName],
44
                'size' => $_FILES[$this->activeForm->requestFormName]['size'][$this->modelName][$this->colName],
45
                'error' => $_FILES[$this->activeForm->requestFormName]['error'][$this->modelName][$this->colName],
46
                    ], [
47
                'upload_code' => 'activeForm:' . $this->activeForm->modelName . ':' . $this->activeForm->model->pk(),
48
                'accept_group' => 'image'
49
            ]);
50
            if ($file_id) {
51
                $this->activeForm->model->{$this->colName} = $file_id;
52
            }
53
        }
54
    }
55
56
}
57