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.

Silk::fakeResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 17
ccs 12
cts 12
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 12
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Silk.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 silk.co Provider
17
 * @link https://silk.co
18
 */
19
class Silk extends \Embera\Adapters\Service
20
{
21
    /** inline {@inheritdoc} */
22
    protected $apiUrl = 'http://www.silk.co/oembed/?format=json';
23
24
    /** inline {@inheritdoc} */
25 2
    protected function validateUrl()
26
    {
27 2
        $this->url->stripQueryString();
28 2
        return (preg_match('~silk\.co/(?:explore|s/embed)/(?:[^ ]+)$~i', $this->url));
29
    }
30
31
    /** inline {@inheritdoc} */
32 2
    public function fakeResponse()
33
    {
34 2
        $url = preg_replace('~^https?://~i', '//', $this->url);
35 2
        $url = preg_replace('~\.silk\.co/(?:explore)/~i', '.silk.co/s/embed/', $url);
36
37 2
        $html = '<div style="display: inline-block; width: 100%; min-height: {height}px;">';
38 2
        $html .= '<div style="position: relative; padding-bottom: 100%; padding-top:25px; height: 0;">';
39 2
        $html .= '<iframe src="' . $url . '?oembed=" style="border:0;position: absolute; top:0; left:0; width: 100%;height:100%; min-height: {height}px;"></iframe>';
40 2
        $html .= '</div></div>';
41
42
        return array(
43 2
            'type' => 'rich',
44 2
            'provider_name' => 'Silk.co',
45 2
            'provider_url' => 'https://silk.co',
46 2
            'html' => $html,
47 2
        );
48
    }
49
}
50
51
?>
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...
52