Code Duplication    Length = 13-13 lines in 2 locations

Classes/ViewHelpers/GetVimeoIdViewHelper.php 1 location

@@ 37-49 (lines=13) @@
34
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later

35
 *

36
 */

37
class GetVimeoIdViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {

38

39
    /**

40
     * @param string $url

41
     * @return string

42
     */

43
    public function render($url) {

44
        if (preg_match("/https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/", $url, $match)) {

45
            $videoId = $match[3];

46
        }

47
        return $videoId;

48
    }

49
}

50

Classes/ViewHelpers/GetYoutubeIdViewHelper.php 1 location

@@ 37-49 (lines=13) @@
34
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later

35
 *

36
 */

37
class GetYoutubeIdViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {

38

39
    /**

40
     * @param string $url

41
     * @return string

42
     */

43
    public function render($url) {

44
        if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match)) {

45
            $videoId = $match[1];

46
        }

47
        return $videoId;

48
    }

49
}

50