Code Duplication    Length = 5-5 lines in 3 locations

catalog/includes/apps/braintree/lib/Braintree/Plan.php 1 location

@@ 19-23 (lines=5) @@
16
        $this->_attributes = $attributes;
17
18
        $addOnArray = [];
19
        if (isset($attributes['addOns'])) {
20
            foreach ($attributes['addOns'] AS $addOn) {
21
                $addOnArray[] = AddOn::factory($addOn);
22
            }
23
        }
24
        $this->_attributes['addOns'] = $addOnArray;
25
26
        $discountArray = [];

catalog/includes/apps/braintree/lib/Braintree/Subscription.php 1 location

@@ 48-52 (lines=5) @@
45
        $this->_attributes = $attributes;
46
47
        $addOnArray = [];
48
        if (isset($attributes['addOns'])) {
49
            foreach ($attributes['addOns'] AS $addOn) {
50
                $addOnArray[] = AddOn::factory($addOn);
51
            }
52
        }
53
        $this->_attributes['addOns'] = $addOnArray;
54
55
        $discountArray = [];

catalog/includes/apps/braintree/lib/Braintree/Transaction.php 1 location

@@ 374-378 (lines=5) @@
371
        $this->_set('statusHistory', $statusHistory);
372
373
        $addOnArray = [];
374
        if (isset($transactionAttribs['addOns'])) {
375
            foreach ($transactionAttribs['addOns'] AS $addOn) {
376
                $addOnArray[] = AddOn::factory($addOn);
377
            }
378
        }
379
        $this->_set('addOns', $addOnArray);
380
381
        $discountArray = [];