Code Duplication    Length = 6-10 lines in 2 locations

src/Controller/Frontend/TradingCardController.php 1 location

@@ 56-65 (lines=10) @@
53
        if ($this->getRequest()->isPost()) {
54
            $data = $this->getRequest()->getFiles()->toArray();
55
56
            if (empty($data)) {
57
                $data = $this->getRequest()->getPost()->toArray();
58
                $key = key($data);
59
                $uploadImage = array(
60
                    'name' => $key.'.png',
61
                    'error' => 0,
62
                    'base64' => $data[$key]
63
                );
64
                $data = array($key => $uploadImage);
65
            }
66
            $path = $this->getGameService()->getGameUserPath($this->game, $this->user);
67
            $media_url = '/'.$this->getGameService()->getGameUserMediaUrl($this->game, $this->user);
68
            $uploadFile = $this->getGameService()->uploadFile(

src/Controller/Frontend/PostVoteController.php 1 location

@@ 418-423 (lines=6) @@
415
        if ($this->getRequest()->isPost()) {
416
            $data = $this->getRequest()->getFiles()->toArray();
417
418
            if (empty($data)) {
419
                $data = $this->getRequest()->getPost()->toArray();
420
                $key = key($data);
421
                $uploadImage = array('name' => $key.'.png', 'error' => 0, 'base64' => $data[$key]);
422
                $data = array($key => $uploadImage);
423
            }
424
            $uploadFile = $this->getGameService()->uploadFileToPost(
425
                $data,
426
                $this->game,