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.
Completed
Pull Request — master (#37)
by
unknown
02:36
created

Deviantart   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 14.29%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 29
ccs 2
cts 14
cp 0.1429
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A modifyResponse() 0 16 3
A validateUrl() 0 4 1
1
<?php
2
/**
3
 * Deviantart.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 deviantart.com Provider
17
 * @link http://deviantart.com
18
 * @link http://www.deviantart.com/developers/oembed
19
 */
20
class Deviantart extends \Embera\Adapters\Service
21
{
22
    /** inline {@inheritdoc} */
23
    protected $apiUrl = 'http://backend.deviantart.com/oembed?format=json';
24
25
    /** inline {@inheritdoc} */
26 2
    protected function validateUrl()
27
    {
28 2
        return (preg_match('~(deviantart\.com/art/(?:[^/]+)|(?:sta\.sh|fav\.me)/([^/]+))/?$~i', $this->url));
29
    }
30
31
    /** inline {@inheritdoc} */
32
    protected function modifyResponse(array $response = array())
33
    {
34
        if (empty($response['html']))
35
        {
36
            if (strtolower($response['type']) == 'photo')
37
            {
38
                $html  = '<a href="' . $response['url'] . '" target="_blank">';
39
                $html .= '<img class="deviantart-oembed" src="' . $response['thumbnail_url_200h'] . '" width="' . $response['thumbnail_width_200h'] . '" height="' . $response['thumbnail_height_200h'] . '" alt="' . htmlspecialchars($response['title'], ENT_QUOTES, 'UTF-8') . '" title="' . htmlspecialchars($response['title'], ENT_QUOTES, 'UTF-8') . '">';
40
                $html .= '</a>';
41
42
                $response['html'] = $html;
43
            }
44
        }
45
46
        return $response;
47
    }
48
}
49
50
?>
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...
51