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.

MicrodataDOMDocument   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loadHTML() 0 7 1
A getItems() 0 3 1
A loadHTMLFile() 0 7 1
1
<?php
2
3
namespace YusufKandemir\MicrodataParser;
4
5
class MicrodataDOMDocument extends \DOMDocument
6
{
7
    /** @var \DOMXPath */
8
    public $xpath;
9
10
    /**
11
     * Get top-level items of the document
12
     *
13
     * @see https://www.w3.org/TR/2018/WD-microdata-20180426/#dfn-top-level-microdata-item
14
     *
15
     * @return \DOMNodeList List of top level items as elements
16
     */
17 39
    public function getItems() : \DOMNodeList
18
    {
19 39
        return $this->xpath->query('//*[@itemscope and not(@itemprop)]');
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     * Also assigns $xpath with DOMXPath of freshly loaded DOMDocument
25
     */
26 42
    public function loadHTML($source, $options = 0)
27
    {
28 42
        $return = parent::loadHTML($source, $options);
29
30 42
        $this->xpath = new \DOMXPath($this);
31
32 42
        return $return;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     * Also assigns $xpath with DOMXPath of freshly loaded DOMDocument
38
     */
39 3
    public function loadHTMLFile($filename, $options = 0)
40
    {
41 3
        $return = parent::loadHTMLFile($filename, $options);
42
43 3
        $this->xpath = new \DOMXPath($this);
44
45 3
        return $return;
46
    }
47
}
48