Code Duplication    Length = 38-38 lines in 2 locations

app/Vendor/PagSeguro/source/PagSeguroLibrary/parser/PagSeguroDirectPaymentParser.class.php 1 location

@@ 143-180 (lines=38) @@
140
        }
141
142
        // shipping
143
        if ($payment->getShipping() != null) {
144
145
            if ($payment->getShipping()->getType() != null && $payment->getShipping()->getType()->getValue() != null) {
146
                $data['shippingType'] = $payment->getShipping()->getType()->getValue();
147
            }
148
149
            if ($payment->getShipping()->getCost() != null && $payment->getShipping()->getCost() != null) {
150
                $data['shippingCost'] = PagSeguroHelper::decimalFormat($payment->getShipping()->getCost());
151
            }
152
153
            // address
154
            if ($payment->getShipping()->getAddress() != null) {
155
                if ($payment->getShipping()->getAddress()->getStreet() != null) {
156
                    $data['shippingAddressStreet'] = $payment->getShipping()->getAddress()->getStreet();
157
                }
158
                if ($payment->getShipping()->getAddress()->getNumber() != null) {
159
                    $data['shippingAddressNumber'] = $payment->getShipping()->getAddress()->getNumber();
160
                }
161
                if ($payment->getShipping()->getAddress()->getComplement() != null) {
162
                    $data['shippingAddressComplement'] = $payment->getShipping()->getAddress()->getComplement();
163
                }
164
                if ($payment->getShipping()->getAddress()->getCity() != null) {
165
                    $data['shippingAddressCity'] = $payment->getShipping()->getAddress()->getCity();
166
                }
167
                if ($payment->getShipping()->getAddress()->getState() != null) {
168
                    $data['shippingAddressState'] = $payment->getShipping()->getAddress()->getState();
169
                }
170
                if ($payment->getShipping()->getAddress()->getDistrict() != null) {
171
                    $data['shippingAddressDistrict'] = $payment->getShipping()->getAddress()->getDistrict();
172
                }
173
                if ($payment->getShipping()->getAddress()->getPostalCode() != null) {
174
                    $data['shippingAddressPostalCode'] = $payment->getShipping()->getAddress()->getPostalCode();
175
                }
176
                if ($payment->getShipping()->getAddress()->getCountry() != null) {
177
                    $data['shippingAddressCountry'] = $payment->getShipping()->getAddress()->getCountry();
178
                }
179
            }
180
        }
181
182
        // Bank name
183
        if ($payment->getOnlineDebit() != null) {

app/Vendor/PagSeguro/source/PagSeguroLibrary/parser/PagSeguroPaymentParser.class.php 1 location

@@ 123-160 (lines=38) @@
120
        }
121
122
        // shipping
123
        if ($payment->getShipping() != null) {
124
125
            if ($payment->getShipping()->getType() != null && $payment->getShipping()->getType()->getValue() != null) {
126
                $data['shippingType'] = $payment->getShipping()->getType()->getValue();
127
            }
128
129
            if ($payment->getShipping()->getCost() != null && $payment->getShipping()->getCost() != null) {
130
                $data['shippingCost'] = PagSeguroHelper::decimalFormat($payment->getShipping()->getCost());
131
            }
132
133
            // address
134
            if ($payment->getShipping()->getAddress() != null) {
135
                if ($payment->getShipping()->getAddress()->getStreet() != null) {
136
                    $data['shippingAddressStreet'] = $payment->getShipping()->getAddress()->getStreet();
137
                }
138
                if ($payment->getShipping()->getAddress()->getNumber() != null) {
139
                    $data['shippingAddressNumber'] = $payment->getShipping()->getAddress()->getNumber();
140
                }
141
                if ($payment->getShipping()->getAddress()->getComplement() != null) {
142
                    $data['shippingAddressComplement'] = $payment->getShipping()->getAddress()->getComplement();
143
                }
144
                if ($payment->getShipping()->getAddress()->getCity() != null) {
145
                    $data['shippingAddressCity'] = $payment->getShipping()->getAddress()->getCity();
146
                }
147
                if ($payment->getShipping()->getAddress()->getState() != null) {
148
                    $data['shippingAddressState'] = $payment->getShipping()->getAddress()->getState();
149
                }
150
                if ($payment->getShipping()->getAddress()->getDistrict() != null) {
151
                    $data['shippingAddressDistrict'] = $payment->getShipping()->getAddress()->getDistrict();
152
                }
153
                if ($payment->getShipping()->getAddress()->getPostalCode() != null) {
154
                    $data['shippingAddressPostalCode'] = $payment->getShipping()->getAddress()->getPostalCode();
155
                }
156
                if ($payment->getShipping()->getAddress()->getCountry() != null) {
157
                    $data['shippingAddressCountry'] = $payment->getShipping()->getAddress()->getCountry();
158
                }
159
            }
160
        }
161
        // maxAge
162
        if ($payment->getMaxAge() != null) {
163
            $data['maxAge'] = $payment->getMaxAge();