Code Duplication    Length = 5-5 lines in 3 locations

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

@@ 27-31 (lines=5) @@
24
        $this->_attributes['addOns'] = $addOnArray;
25
26
        $discountArray = [];
27
        if (isset($attributes['discounts'])) {
28
            foreach ($attributes['discounts'] AS $discount) {
29
                $discountArray[] = Discount::factory($discount);
30
            }
31
        }
32
        $this->_attributes['discounts'] = $discountArray;
33
34
        $planArray = [];

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

@@ 56-60 (lines=5) @@
53
        $this->_attributes['addOns'] = $addOnArray;
54
55
        $discountArray = [];
56
        if (isset($attributes['discounts'])) {
57
            foreach ($attributes['discounts'] AS $discount) {
58
                $discountArray[] = Discount::factory($discount);
59
            }
60
        }
61
        $this->_attributes['discounts'] = $discountArray;
62
63
        if (isset($attributes['descriptor'])) {

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

@@ 382-386 (lines=5) @@
379
        $this->_set('addOns', $addOnArray);
380
381
        $discountArray = [];
382
        if (isset($transactionAttribs['discounts'])) {
383
            foreach ($transactionAttribs['discounts'] AS $discount) {
384
                $discountArray[] = Discount::factory($discount);
385
            }
386
        }
387
        $this->_set('discounts', $discountArray);
388
389
        if(isset($transactionAttribs['riskData'])) {