Code Duplication    Length = 20-20 lines in 2 locations

src/Database/UploadTableInfo.php 1 location

@@ 62-81 (lines=20) @@
59
        ]);
60
    }
61
62
    public function createEmojiKeywords($emoji_id, $keywords)
63
    {
64
        if ($keywords) {
65
            $splittedKeywords = explode(',', $keywords);
66
67
            $created_at = date('Y-m-d h:i:s');
68
69
            foreach ($splittedKeywords as $keyword) {
70
                $emojiKeyword = Keyword::create([
71
                    'emoji_id'     => $emoji_id,
72
                    'keyword_name' => $keyword,
73
                    'created_at'   => $created_at,
74
                ]);
75
            }
76
        }
77
78
        return $emojiKeyword->id;
79
    }
80
}
81

src/Controller/EmojiController.php 1 location

@@ 258-277 (lines=20) @@
255
     *
256
     * @return $id
257
     */
258
    public function createEmojiKeywords($emoji_id, $keywords)
259
    {
260
        if ($keywords) {
261
            $splittedKeywords = explode(',', $keywords);
262
263
            $created_at = date('Y-m-d h:i:s');
264
265
            foreach ($splittedKeywords as $keyword) {
266
                $emojiKeyword = Keyword::create([
267
                        'emoji_id'     => $emoji_id,
268
                        'keyword_name' => $keyword,
269
                        'created_at'   => $created_at,
270
                ]);
271
            }
272
        }
273
274
        return $emojiKeyword->id;
275
    }
276
277
    /**
278
     * This method format emoji result.
279
     *
280
     * @param $emojis