Code Duplication    Length = 9-10 lines in 4 locations

src/Kunstmaan/MediaBundle/Helper/RemoteVideo/RemoteVideoHandler.php 4 locations

@@ 217-225 (lines=9) @@
214
            }
215
            $parsedUrl = parse_url($data);
216
            switch ($parsedUrl['host']) {
217
                case 'youtu.be':
218
                    $code = substr($parsedUrl['path'], 1); // remove slash
219
                    $result = new Media();
220
                    $video = new RemoteVideoHelper($result);
221
                    $video->setType('youtube');
222
                    $video->setCode($code);
223
                    $result = $video->getMedia();
224
                    $result->setName('Youtube ' . $code);
225
226
                    break;
227
228
                case 'www.youtube.com':
@@ 229-238 (lines=10) @@
226
                    break;
227
228
                case 'www.youtube.com':
229
                case 'youtube.com':
230
                    parse_str($parsedUrl['query'], $queryFields);
231
                    $code = $queryFields['v'];
232
                    $result = new Media();
233
                    $video = new RemoteVideoHelper($result);
234
                    $video->setType('youtube');
235
                    $video->setCode($code);
236
                    $result = $video->getMedia();
237
                    $result->setName('Youtube ' . $code);
238
239
                    break;
240
                case 'www.vimeo.com':
241
                case 'vimeo.com':
@@ 241-249 (lines=9) @@
238
239
                    break;
240
                case 'www.vimeo.com':
241
                case 'vimeo.com':
242
                    $code = substr($parsedUrl['path'], 1);
243
                    $result = new Media();
244
                    $video = new RemoteVideoHelper($result);
245
                    $video->setType('vimeo');
246
                    $video->setCode($code);
247
                    $result = $video->getMedia();
248
                    $result->setName('Vimeo ' . $code);
249
250
                    break;
251
                case 'www.dailymotion.com':
252
                case 'dailymotion.com':
@@ 252-260 (lines=9) @@
249
250
                    break;
251
                case 'www.dailymotion.com':
252
                case 'dailymotion.com':
253
                    $code = substr($parsedUrl['path'], 7);
254
                    $result = new Media();
255
                    $video = new RemoteVideoHelper($result);
256
                    $video->setType('dailymotion');
257
                    $video->setCode($code);
258
                    $result = $video->getMedia();
259
                    $result->setName('Dailymotion ' . $code);
260
261
                    break;
262
            }
263
        }