Code Duplication    Length = 8-12 lines in 2 locations

lib/Ajde/Embed/Vimeo.php 1 location

@@ 25-32 (lines=8) @@
22
23
    private function _getVimeoId()
24
    {
25
        if (substr($this->_code, 0, 7) == 'http://' || substr($this->_code, 0, 8) == 'https://') {
26
            return str_replace('/', '', parse_url($this->_code, PHP_URL_PATH));
27
        } else {
28
            $matches = [];
29
            preg_match('%video/([0-9]+?)[\/\?\"]%', $this->_code, $matches);
30
31
            return isset($matches[1]) ? $matches[1] : null;
32
        }
33
    }
34
35
    public function getThumbnail()

lib/Ajde/Embed/Youtube.php 1 location

@@ 28-39 (lines=12) @@
25
    {
26
        if (substr($this->_code, 0, 15) == 'http://youtu.be') {
27
            return substr($this->_code, 16, 11);
28
        } else {
29
            if (substr($this->_code, 0, 7) == 'http://' || substr($this->_code, 0, 8) == 'https://') {
30
                parse_str(parse_url($this->_code, PHP_URL_QUERY), $querystringArray);
31
32
                return $querystringArray['v'];
33
            } else {
34
                $matches = [];
35
                preg_match('%embed\/(.+?)[\/\?\"]%', $this->_code, $matches);
36
37
                return isset($matches[1]) ? substr($matches[1], 0, 11) : null;
38
            }
39
        }
40
    }
41
42
    public function getThumbnail()