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.

Bambuser   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 79.41%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 59
ccs 27
cts 34
cp 0.7941
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B fakeResponse() 0 32 3
A validateUrl() 0 9 2
A normalizeUrl() 0 6 2
1
<?php
2
/**
3
 * Bambuser.php
4
 *
5
 * @package Providers
6
 * @author Michael Pratt <[email protected]>
7
 * @link   http://www.michael-pratt.com/
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Embera\Providers;
14
15
/**
16
 * The bambuser.com Provider
17
 * @link http://bambuser.com
18
 * @link http://bambuser.com/api/embed_oembed
19
 */
20
class Bambuser extends \Embera\Adapters\Service
21
{
22
    /** inline {@inheritdoc} */
23
    protected $apiUrl = 'http://api.bambuser.com/oembed.json';
24
25
    /** inline {@inheritdoc} */
26 2
    protected function validateUrl()
27
    {
28 2
        $this->url->stripLastSlash();
29 2
        $this->url->stripWWW();
30
31
        return (
32 2
            preg_match('~bambuser\.com/v/(?:[0-9]+)$~i', $this->url) || preg_match('~bambuser\.com/channel/(?:[^/]+)$~i', $this->url)
33 2
        );
34
    }
35
36
    /** inline {@inheritdoc} */
37 2
    public function normalizeUrl()
38
    {
39 2
        if (preg_match('~bambuser\.com/channel/(?:[^/]+)/broadcast/([0-9]+)~i', $this->url, $matches)) {
40 2
            $this->url = new \Embera\Url('http://bambuser.com/v/' . $matches['1']);
41 2
        }
42 2
    }
43
44
    /** inline {@inheritdoc} */
45 2
    public function fakeResponse()
46
    {
47
        $defaults = array(
48 2
            'type' => 'video',
49 2
            'provider_name' => 'Bambuser.com',
50 2
            'provider_url' => 'http://bambuser.com',
51 2
        );
52
53 2
        $html  = '<object id="bplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}">';
54 2
        $html .= '<embed  allowfullscreen="true" allowscriptaccess="always" wmode="transparent" type="application/x-shockwave-flash" name="bplayer" src="https://static.bambuser.com/r/player.swf?{query}&amp;context=oembed" width="{width}" height="{height}" />';
55 2
        $html .= '<param name="movie" value="https://static.bambuser.com/r/player.swf?context=oembed&amp;{query}" />';
56 2
        $html .= '<param name="allowfullscreen" value="true" />';
57 2
        $html .= '<param name="allowscriptaccess" value="always" />';
58 2
        $html .= '<param name="wmode" value="transparent" />';
59 2
        $html .= '</object>';
60
61 2
        if (preg_match('~/v/([0-9]+)$~i', $this->url, $matches)) {
62 2
            return array_merge(
63 2
                $defaults,
64 2
                array('html' => str_replace('{query}', 'vid=' . $matches['1'], $html))
65 2
            );
66
        }
67
        else if (preg_match('~/channel/([^/]+)~i', $this->url, $matches))
68
        {
69
            return array_merge(
70
                $defaults,
71
                array('html' => str_replace('{query}', 'username=' . urlencode($matches['1']), $html))
72
            );
73
        }
74
75
        return array();
76
    }
77
78
}
79
80
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
81