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 (#42)
by
unknown
01:53
created

FirstClass::publicMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
class FirstClass {
4
5
    protected $_protectedProperty;
6
    public $publicProperty;
7
8
    protected function _protectedMethod() {
9
        echo "This is protected method of first class";
10
    }
11
12
    public function publicMethod() {
13
        echo "This is public method of first class";
14
    }
15
}
16
17 View Code Duplication
class SecondClass extends FirstClass {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
19
    private $_privateProperty;
20
21
    protected function _protectedMethod() {
22
        parent::_protectedMethod();
23
        echo "This is protected method of second class";
24
        $this->_privateProperty = parent::$_protectedProperty;
25
    }
26
27
    public function publicMethod() {
28
        parent::publicMethod();
29
        echo "This is public method of second class";
30
        $this->_privateProperty = parent::$publicProperty;
31
    }
32
33
    static public function anotherPublicMethod() {
34
    }
35
}
36
37
class ThirdClass {
38
39
    private $publicProperty;
40
41
    static private function anotherPublicMethod() {
42
43
    }
44
45
    public function __construct(SecondClass $secondObject) {
46
        $secondObject->publicMethod();
47
        $secondObject::anotherPublicMethod();
48
        $secondObject->publicProperty = 'test';
49
    }
50
51
    private function publicMethod() {
52
        echo 'test';
53
    }
54
55
    protected function someFunc() {
56
        $this->publicProperty = 'test';
57
        $this->publicMethod();
58
        self::anotherPublicMethod();
0 ignored issues
show
Unused Code introduced by
The call to the method ThirdClass::anotherPublicMethod() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
59
    }
60
}