Receiver   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 16
loc 16
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createFromXML() 7 7 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Bpost\BpostApiClient\Bpost\Order;
3
4
/**
5
 * bPost Receiver class
6
 *
7
 * @author Tijs Verkoyen <[email protected]>
8
 */
9 View Code Duplication
class Receiver extends Customer
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...
10
{
11
    const TAG_NAME = 'receiver';
12
13
    /**
14
     * @param  \SimpleXMLElement $xml
15
     * @return Receiver
16
     */
17 2
    public static function createFromXML(\SimpleXMLElement $xml)
18
    {
19 2
        $receiver = new Receiver();
20 2
        $receiver = parent::createFromXMLHelper($xml, $receiver);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (createFromXMLHelper() instead of createFromXML()). Are you sure this is correct? If so, you might want to change this to $this->createFromXMLHelper().

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...
21
22 2
        return $receiver;
23
    }
24
}
25