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.

XMLReader   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 57
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 3
A open() 0 8 1
A reopen() 0 4 1
1
<?php
2
3
namespace UCD\Infrastructure\Repository\CharacterRepository\XMLRepository;
4
5
use UCD\Exception\InvalidArgumentException;
6
use UCD\Exception\RuntimeException;
7
8
class XMLReader extends \XMLReader
9
{
10
    /**
11
     * @var string
12
     */
13
    private $openUri;
14
15
    /**
16
     * @var string|null
17
     */
18
    private $openEncoding;
19
20
    /**
21
     * @var int
22
     */
23
    private $openOptions;
24
25
    /**
26
     * @param string $uri
27
     * @param string|null $encoding
28
     * @param int $options
29
     * @throws InvalidArgumentException
30
     * @throws RuntimeException
31
     */
32
    public function __construct($uri, $encoding = null, $options = 0)
33
    {
34
        if (!is_readable($uri)) {
35
            throw new InvalidArgumentException(sprintf('Invalid URI: %s', $uri));
36
        }
37
38
        $result = $this->open($uri, $encoding, $options);
39
40
        if ($result !== true) {
41
            throw new RuntimeException(sprintf('Could not open %s', $uri));
42
        }
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48
    public function open($uri, $encoding = null, $options = 0)
49
    {
50
        $this->openUri = $uri;
51
        $this->openEncoding = $encoding;
52
        $this->openOptions = $options;
53
54
        return parent::open($uri, $encoding, $options);
55
    }
56
57
    /**
58
     * @return bool
59
     */
60
    public function reopen()
61
    {
62
        return parent::open($this->openUri, $this->openEncoding, $this->openOptions);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (open() instead of reopen()). Are you sure this is correct? If so, you might want to change this to $this->open().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
63
    }
64
}