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.

Scribd::fakeResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Scribd.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 scribd.com Provider
17
 * @link http://scribd.com
18
 */
19
class Scribd extends \Embera\Adapters\Service
20
{
21
    /** inline {@inheritdoc} */
22
    protected $apiUrl = 'http://www.scribd.com/services/oembed/?format=json';
23
24
    /** inline {@inheritdoc} */
25 2
    protected function validateUrl()
26
    {
27 2
        $this->url->stripQueryString();
28
29 2
        return (preg_match('~scribd\.com/(doc|document)/(?:[0-9]+)/(?:[^/]+)/?$~i', $this->url));
30
    }
31
32
    /** inline {@inheritdoc} */
33 2
    protected function modifyResponse(array $response = array())
34
    {
35 2
        if (!empty($response['html']))
36 2
        {
37 2
            $response['html'] = str_replace('#{root_url}', 'https://www.scribd.com/', $response['html']);
38 2
            $response['html'] = preg_replace('~\s+~i', ' ', $response['html']); // Remove double spaces
39 2
        }
40
41 2
        return $response;
42
    }
43
44
    /** inline {@inheritdoc} */
45 2
    public function fakeResponse()
46
    {
47 2
        preg_match('~/(doc|document)/([\d]+)/~i', $this->url, $matches);
48
49
        return array(
50 2
            'type' => 'rich',
51 2
            'provider_name' => 'Scribd',
52 2
            'provider_url' => 'https://www.scribd.com',
53 2
            'html' => '<iframe class="scribd_iframe_embed" data-aspect-ratio="" frameborder="0" height="{height}" id="' . $matches['1'] . '" scrolling="no" src="https://www.scribd.com/embeds/' . $matches['1'] . '/content" width="100%"></iframe><script type="text/javascript">(function() { var scribd = document.createElement("script"); scribd.type = "text/javascript"; scribd.async = true; scribd.src = "http://www.scribd.com/javascripts/embed_code/inject.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(scribd, s); })();</script>',
54 2
        );
55
    }
56
}
57