Code Duplication    Length = 34-34 lines in 2 locations

src/Intraface/XMLRPC/Shop/Server0100.php 1 location

@@ 393-426 (lines=34) @@
390
     * @param array products
391
     * @return array cleaned up products
392
     */
393
    private function cleanUpProductList($products)
394
    {
395
        $return = array();
396
        foreach ($products as $key => $p) {
397
            $return[$key]['id'] = $p['id'];
398
            $return[$key]['number'] = $p['number'];
399
            $return[$key]['name'] = $p['name'];
400
            $return[$key]['price'] = $p['price'];
401
            $return[$key]['unit'] = $p['unit'];
402
            $return[$key]['vat'] = $p['vat'];
403
            $return[$key]['weight'] = $p['weight'];
404
            $return[$key]['detail_id'] = $p['detail_id'];
405
            $return[$key]['vat_percent'] = $p['vat_percent'];
406
            $return[$key]['price_incl_vat'] = $p['price_incl_vat'];
407
            $return[$key]['stock'] = $p['stock'];
408
            $return[$key]['has_variation'] = $p['has_variation'];
409
            $return[$key]['stock_status'] = $p['stock_status'];
410
411
            foreach ($p['currency'] as $k => $c) {
412
                $return[$key]['currency'][$k]['price'] = $c['price']->getAsIso(2);
413
                $return[$key]['currency'][$k]['price_incl_vat'] = $c['price_incl_vat']->getAsIso(2);
414
                $return[$key]['currency'][$k]['before_price'] = $c['before_price']->getAsIso(2);
415
                $return[$key]['currency'][$k]['before_price_incl_vat'] = $c['before_price_incl_vat']->getAsIso(2);
416
            }
417
418
            if (isset($p['pictures'])) {
419
                $return[$key]['pictures'] = $p['pictures'];
420
            }
421
        }
422
423
        return $return;
424
    }
425
426
    /**
427
     * Gets one product
428
     *
429
     * @param struct  $credentials Credentials to use the server

src/Intraface/XMLRPC/Shop/Server0004.php 1 location

@@ 228-261 (lines=34) @@
225
     * @param array products
226
     * @return array cleaned up products
227
     */
228
    private function cleanUpProductList($products)
229
    {
230
        $return = array();
231
        foreach ($products as $key => $p) {
232
            $return[$key]['id'] = $p['id'];
233
            $return[$key]['number'] = $p['number'];
234
            $return[$key]['name'] = $p['name'];
235
            $return[$key]['price'] = $p['price'];
236
            $return[$key]['unit'] = $p['unit'];
237
            $return[$key]['vat'] = $p['vat'];
238
            $return[$key]['weight'] = $p['weight'];
239
            $return[$key]['detail_id'] = $p['detail_id'];
240
            $return[$key]['vat_percent'] = $p['vat_percent'];
241
            $return[$key]['price_incl_vat'] = $p['price_incl_vat'];
242
            $return[$key]['stock'] = $p['stock'];
243
            $return[$key]['has_variation'] = $p['has_variation'];
244
            $return[$key]['stock_status'] = $p['stock_status'];
245
246
            foreach ($p['currency'] as $k => $c) {
247
                $return[$key]['currency'][$k]['price'] = $c['price']->getAsIso(2);
248
                $return[$key]['currency'][$k]['price_incl_vat'] = $c['price_incl_vat']->getAsIso(2);
249
                $return[$key]['currency'][$k]['before_price'] = $c['before_price']->getAsIso(2);
250
                $return[$key]['currency'][$k]['before_price_incl_vat'] = $c['before_price_incl_vat']->getAsIso(2);
251
            }
252
253
            if (isset($p['pictures'])) {
254
                $return[$key]['pictures'] = $p['pictures'];
255
            }
256
        }
257
258
        return $return;
259
    }
260
261
    /**
262
     * Gets one product
263
     *
264
     * @param struct  $credentials Credentials to use the server