Code Duplication    Length = 19-19 lines in 2 locations

src/delivery/web/adapters/curir/CurirParameterReader.php 1 location

@@ 37-55 (lines=19) @@
34
        return $this->request->getArguments()->has($parameter->getName());
35
    }
36
37
    private function map($value) {
38
        if (is_array($value) || $value instanceof Collection) {
39
            $mapped = [];
40
            foreach ($value as $key => $item) {
41
                $mapped[$key] = $this->map($item);
42
            }
43
            return $mapped;
44
        } else if ($value instanceof UploadedFile) {
45
            return [
46
                'name' => $value->getName(),
47
                'tmp_name' => $value->getTemporaryName(),
48
                'error' => $value->getError(),
49
                'size' => $value->getSize(),
50
                'type' => $value->getType()
51
            ];
52
        } else {
53
            return $value;
54
        }
55
    }
56
}

src/delivery/web/adapters/silex/SilexParameterReader.php 1 location

@@ 43-61 (lines=19) @@
40
        || $this->request->get($parameter->getName(), '__NOPEDINOPE__') != '__NOPEDINOPE__';
41
    }
42
43
    private function map($value) {
44
        if (is_array($value)) {
45
            $mapped = [];
46
            foreach ($value as $key => $item) {
47
                $mapped[$key] = $this->map($item);
48
            }
49
            return $mapped;
50
        } else if ($value instanceof UploadedFile) {
51
            return [
52
                'name' => $value->getClientOriginalName(),
53
                'tmp_name' => $value->getPath() . DIRECTORY_SEPARATOR . $value->getFilename(),
54
                'error' => $value->getError(),
55
                'size' => $value->getSize(),
56
                'type' => $value->getType()
57
            ];
58
        } else {
59
            return $value;
60
        }
61
    }
62
}