Code Duplication    Length = 5-5 lines in 2 locations

src/Factories/Entities/FileFactory.php 1 location

@@ 29-33 (lines=5) @@
26
        $arr = ['path' => null, 'timestamp' => null, 'size' => null, 'mimetype' => null];
27
        $compare = array_diff_key($arr, $data);
28
29
        if (!empty($compare)) {
30
            $fields = array_keys($compare);
31
            $msg = sprintf($translator->getMessage('validations.requiredField'), $fields[0]);
32
            throw new InvalidArgumentException($msg, 400);
33
        }
34
35
        $entity = new File();
36
        $entity->setPath($data['path']);

src/Factories/Entities/UploadFactory.php 1 location

@@ 29-33 (lines=5) @@
26
27
        $compare = array_diff_key($arr, $data);
28
29
        if (!empty($compare)) {
30
            $fields = array_keys($compare);
31
            $msg = sprintf($translator->getMessage('validations.requiredField'), $fields[0]);
32
            throw new InvalidArgumentException($msg, 400);
33
        }
34
35
        $entity = (new Upload())
36
            ->setName($data['name'])