VisitingAddress::createFromArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 8
cts 8
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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
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