GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Rutube   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 55.56%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 38
ccs 10
cts 18
cp 0.5556
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A validateUrl() 0 7 1
A normalizeUrl() 0 8 2
A fakeResponse() 0 12 1
1
<?php
2
/**
3
 * Rutube.php
4
 *
5
 * @package Providers
6
 * @author dotzero <[email protected]>
7
 * @link   http://www.dotzero.ru/
8
 */
9
10
namespace Embera\Providers;
11
12
/**
13
 * The Rutube.ru Provider
14
 */
15
class Rutube extends \Embera\Adapters\Service
16
{
17
    /** inline {@inheritdoc} */
18
    protected $apiUrl = 'http://rutube.ru/api/oembed/?format=json';
19
20
    /** inline {@inheritdoc} */
21 2
    protected function validateUrl()
22
    {
23 2
        $this->url->stripWWW();
24 2
        $this->url->stripQueryString();
25
26 2
        return (preg_match('~\/video\/([a-z0-9]{25,})~i', $this->url));
27
    }
28
29
    /** inline {@inheritdoc} */
30 2
    protected function normalizeUrl()
31
    {
32 2
        $this->url->stripQueryString();
33
34 2
        if (preg_match('~\/video\/([a-z0-9]{25,})~i', $this->url, $matches)) {
35 2
            $this->url = new \Embera\Url('http://rutube.ru/video/' . $matches['1'] . '/');
36 2
        }
37 2
    }
38
39
    /** inline {@inheritdoc} */
40
    public function fakeResponse()
41
    {
42
        preg_match('~\/video\/([a-z0-9]{25,})~i', $this->url, $matches);
43
44
        return array(
45
            'type' => 'video',
46
            'provider_name' => 'Rutube',
47
            'provider_url' => 'http://rutube.ru',
48
            'title' => 'Unknown title',
49
            'html' => '<iframe src="//rutube.ru/video/embed/' . $matches['1'] . '" width="{width}" height="{height}" frameborder="0" title="" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
50
        );
51
    }
52
}
53