Code Duplication    Length = 6-10 lines in 2 locations

src/PlaygroundGame/Controller/Frontend/TradingCardController.php 1 location

@@ 49-58 (lines=10) @@
46
        if ($this->getRequest()->isPost()) {
47
            $data = $this->getRequest()->getFiles()->toArray();
48
49
            if (empty($data)) {
50
                $data = $this->getRequest()->getPost()->toArray();
51
                $key = key($data);
52
                $uploadImage = array(
53
                    'name' => $key.'.png',
54
                    'error' => 0,
55
                    'base64' => $data[$key]
56
                );
57
                $data = array($key => $uploadImage);
58
            }
59
            $path = $this->getGameService()->getGameUserPath($this->game, $this->user);
60
            $media_url = '/'.$this->getGameService()->getGameUserMediaUrl($this->game, $this->user);
61
            $uploadFile = $this->getGameService()->uploadFile(

src/PlaygroundGame/Controller/Frontend/PostVoteController.php 1 location

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