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.

PollDaddy   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 41
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A modifyResponse() 0 8 2
A validateUrl() 0 7 1
1
<?php
2
/**
3
 * PollDaddy.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 polldaddy.com Provider
17
 * @link http://support.polldaddy.com/oembed/
18
 * @link http://polldaddy.com
19
 *
20
 * TODO: This provider should be able to provide fake responses,
21
 * but there are cases when it is not possible, so the code is commented
22
 * out.
23
 */
24
class PollDaddy extends \Embera\Adapters\Service
25
{
26
    /** inline {@inheritdoc} */
27
    protected $apiUrl = 'http://polldaddy.com/oembed/?format=json';
28
29
    /** inline {@inheritdoc} */
30 2
    protected function validateUrl()
31
    {
32 2
        $this->url->convertToHttp();
33 2
        $this->url->stripWWW();
34
35 2
        return (preg_match('~polldaddy\.com/(?:poll|s|ratings)/(?:[^/]+)/?$~i', $this->url));
36
    }
37
38
    /** inline {@inheritdoc} */
39 2
    protected function modifyResponse(array $response = array())
40
    {
41 2
        if (!empty($response['html'])) {
42 2
            $response['html'] = preg_replace('~<noscript>(.*)</noscript>~is', '', $response['html']);
43 2
        }
44
45 2
        return $response;
46
    }
47
48
    /** inline {@inheritdoc} */
49
    /*
50
    public function fakeResponse()
51
    {
52
        if (preg_match('~/poll/([\d]+)/?$~i', $this->url, $matches))
53
        {
54
            return array(
55
                'type' => 'rich',
56
                'provider_name' => 'Polldaddy',
57
                'provider_url' => 'http://polldaddy.com',
58
                'html' => '<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/' . $matches['1'] . '.js"></script>'
59
            );
60
        }
61
62
        return array();
63
    } */
64
}
65
66
?>
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...
67