VimeoParser   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 59
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1
ccs 12
cts 12
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A videoId() 0 4 1
A defaultQueries() 0 4 1
A getIframePattern() 0 4 1
A getIframeReplacer() 0 7 1
A getInfoUrl() 0 4 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