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.

Dom   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 59
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A fetchValues() 0 12 2
A getURLs() 0 4 1
A getImageURLs() 0 4 1
A getScriptURLs() 0 4 1
A getCssURLs() 0 4 1
1
<?php
2
/**
3
 * Util
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
9
namespace Pimf\Util;
10
11
/**
12
 * A powerful tool for HTML or XML document manipulation and extraction of data.
13
 *
14
 * @package Util
15
 * @author  Gjero Krsteski <[email protected]>
16
 */
17
class Dom extends \DOMDocument
18
{
19
    /**
20
     * Retries a list of attributes-value which can live inside a HTML/XML-Element
21
     *
22
     * @param string $tag       A HTML/XML tag-name representation for the HTML/XML-Element
23
     * @param string $attribute A attribute inside of the HTML/XML-Element
24
     *
25
     * @return array
26
     */
27
    public function fetchValues($tag, $attribute)
28
    {
29
        $values = array();
30
31
        // loop through each tag in the dom and add it to the array
32
        foreach ($this->getElementsByTagName($tag) as $element) {
33
            /* @var $element \DOMElement */
34
            $values[] = $element->getAttribute($attribute);
35
        }
36
37
        return $values;
38
    }
39
40
    /**
41
     * Grab all links in a page
42
     *
43
     * @return array
44
     */
45
    public function getURLs()
46
    {
47
        return $this->fetchValues('a', 'href');
48
    }
49
50
    /**
51
     * Grab all URLs of an image
52
     *
53
     * @return array
54
     */
55
    public function getImageURLs()
56
    {
57
        return $this->fetchValues('img', 'src');
58
    }
59
60
    /**
61
     * Grab all URLs of an external script file like JS
62
     */
63
    public function getScriptURLs()
64
    {
65
        return $this->fetchValues('script', 'src');
66
    }
67
68
    /**
69
     * Grab all URLs location of the linked document like CSS
70
     */
71
    public function getCssURLs()
72
    {
73
        return $this->fetchValues('link', 'href');
74
    }
75
}
76