VisitingAddress   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createFromArray() 11 11 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
3
declare(strict_types=1);
4
5
namespace Billogram\Model\Setting;
6
7
use Billogram\Model\BaseAddress;
8
9
/**
10
 * @author Ibrahim Hizeoui <[email protected]>
11
 */
12 View Code Duplication
class VisitingAddress extends BaseAddress
0 ignored issues
show
Duplication introduced by Ibrahimhizeoui
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...
13
{
14
    /**
15
     * Create an API response object from the HTTP response from the API server.
16
     *
17
     * @param array $data
18
     *
19
     * @return self
20
     */
21 2
    public static function createFromArray(array $data)
22
    {
23 2
        $visitingAddress = new self();
24 2
        $visitingAddress->careOf = $data['careof'] ?? null;
25 2
        $visitingAddress->streetAddress = $data['street_address'] ?? null;
26 2
        $visitingAddress->zipCode = $data['zipcode'] ?? null;
27 2
        $visitingAddress->city = $data['city'] ?? null;
28 2
        $visitingAddress->country = $data['country'] ?? null;
29
30 2
        return $visitingAddress;
31
    }
32
}
33