Code Duplication    Length = 23-23 lines in 2 locations

src/Entity/AlternateDeliveryAddress.php 1 location

@@ 24-46 (lines=23) @@
21
     *
22
     * @return \DOMElement
23
     */
24
    public function toNode(DOMDocument $document = null)
25
    {
26
        if (null === $document) {
27
            $document = new DOMDocument();
28
        }
29
30
        $node = $document->createElement('AlternateDeliveryAddress');
31
32
        if ($this->getName()) {
33
            $node->appendChild($document->createElement('Name', $this->getName()));
34
        }
35
36
        if ($this->getUpsAccessPointId()) {
37
            $node->appendChild($document->createElement('UPSAccessPointID', $this->getUpsAccessPointId()));
38
        }
39
40
        $address = $this->getAddress();
41
        if (isset($address)) {
42
            $node->appendChild($address->toNode($document));
43
        }
44
45
        return $node;
46
    }
47
48
    /**
49
     * @return mixed

src/Entity/ShipFrom.php 1 location

@@ 16-38 (lines=23) @@
13
     *
14
     * @return DOMElement
15
     */
16
    public function toNode(DOMDocument $document = null)
17
    {
18
        if (null === $document) {
19
            $document = new DOMDocument();
20
        }
21
22
        $node = $document->createElement('ShipFrom');
23
24
        if ($this->getCompanyName()) {
25
            $node->appendChild($document->createElement('CompanyName', $this->getCompanyName()));
26
        }
27
28
        if ($this->getAttentionName()) {
29
            $node->appendChild($document->createElement('AttentionName', $this->getAttentionName()));
30
        }
31
32
        $address = $this->getAddress();
33
        if (isset($address)) {
34
            $node->appendChild($address->toNode($document));
35
        }
36
37
        return $node;
38
    }
39
}
40