Code Duplication    Length = 9-13 lines in 3 locations

src/Entity/PackageWeight.php 1 location

@@ 27-35 (lines=9) @@
24
     */
25
    private $weight;
26
27
    public function __construct($attributes = null)
28
    {
29
        $this->setUnitOfMeasurement(new UnitOfMeasurement(
30
            isset($attributes->UnitOfMeasurement) ? $attributes->UnitOfMeasurement : null
31
        ));
32
        if (isset($attributes->Weight)) {
33
            $this->setWeight($attributes->Weight);
34
        }
35
    }
36
37
    /**
38
     * @param null|DOMDocument $document

src/Entity/ShipmentWeight.php 1 location

@@ 14-26 (lines=13) @@
11
    private $unitOfMeasurement;
12
    private $weight;
13
14
    public function __construct($response = null)
15
    {
16
        $this->setUnitOfMeasurement(new UnitOfMeasurement());
17
18
        if (null !== $response) {
19
            if (isset($response->UnitOfMeasurement)) {
20
                $this->setUnitOfMeasurement(new UnitOfMeasurement($response->UnitOfMeasurement));
21
            }
22
            if (isset($response->Weight)) {
23
                $this->setWeight($response->Weight);
24
            }
25
        }
26
    }
27
28
    /**
29
     * @param null|DOMDocument $document

src/Entity/ShipmentTotalWeight.php 1 location

@@ 23-33 (lines=11) @@
20
    **/
21
    private $weight;
22
23
    public function __construct($response = null)
24
    {
25
        if (null !== $response) {
26
            if (isset($response->unitOfMeasurement)) {
27
                $this->setUnitOfMeasurement(new UnitOfMeasurement($response->unitOfMeasurement));
28
            }
29
            if (isset($response->Weight)) {
30
                $this->setWeight($response->Weight);
31
            }
32
        }
33
    }
34
35
    /**
36
     * @param null|DOMDocument $document