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.

ImageHelper::fetch()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Undefined\Stash;
3
4
class ImageHelper
5
{
6
    /**
7
     * Returns a absolute url from the image directory
8
     *
9
     * @param $name
10
     * @return string
11
     */
12
    function get($name)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
13
    {
14
        return get_template_directory_uri() . '/dist/images/' . $name;
15
    }
16
17
    /**
18
     * Returns a relative url from the image directory
19
     *
20
     * @param $name
21
     * @return string
22
     */
23
    function fetch($name)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
24
    {
25
        return get_stylesheet_directory() . '/dist/images/' . $name;
26
    }
27
28
    function display($name)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
29
    {
30
        return "<img src='" . $this->get($name) . "' />";
31
    }
32
33
    /**
34
     * Returns svg code for SVG injection in the DOM from the uploads directory
35
     *
36
     * @param $imageObject TimberImage Instance
37
     * @return string
38
     */
39
    function embedTimberSVG($imageObject)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
40
    {
41
        $svgfile = get_attached_file($imageObject->ID, true);
42
43
        if (file_exists($svgfile)) {
44
            $returnFile = file_get_contents($svgfile);
45
        } else {
46
            $returnFile = 'IMAGE DOES NOT EXIST';
47
        }
48
49
        return $returnFile;
50
    }
51
}