Code Duplication    Length = 6-10 lines in 2 locations

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

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

src/PlaygroundGame/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(