VimeoParser::getIframePattern()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanedev\EmbedVideo\Parsers;
2
3
/**
4
 * Class     VimeoParser
5
 *
6
 * @package  Arcanedev\EmbedVideo\Parsers
7
 * @author   ARCANEDEV <[email protected]>
8
 */
9
class VimeoParser extends AbstractParser
10
{
11
    /* -----------------------------------------------------------------
12
     |  Getters & Setters
13
     | -----------------------------------------------------------------
14
     */
15
    /**
16
     * Get the video id from cached matches.
17
     *
18
     * @return mixed
19
     */
20 9
    public function videoId()
21
    {
22 9
        return $this->getCached(2);
23
    }
24
25
    /**
26
     * Get the default URL queries.
27
     *
28
     * @return array
29
     */
30 24
    protected function defaultQueries()
31
    {
32 24
        return [];
33
    }
34
35
    /**
36
     * Get the iframe pattern.
37
     *
38
     * @return string
39
     */
40 3
    protected function getIframePattern()
41
    {
42 3
        return '{protocol}://player.vimeo.com/video/{id}';
43
    }
44
45
    /**
46
     * Get the iframe replace.
47
     *
48
     * @return array
49
     */
50 3
    protected function getIframeReplacer()
51
    {
52
        return [
53 3
            '{protocol}' => $this->protocol,
54 3
            '{id}'       => $this->videoId(),
55 1
        ];
56
    }
57
58
    /**
59
     * Get the info URL.
60
     *
61
     * @return string
62
     */
63 3
    public function getInfoUrl()
64
    {
65 3
        return $this->protocol.'://vimeo.com/'.$this->videoId();
66
    }
67
}
68