Code Duplication    Length = 24-27 lines in 2 locations

src/Intraface/modules/product/Product.php 2 locations

@@ 240-263 (lines=24) @@
237
238
        $this->value['pictures'] = array();
239
240
        if (count($appendix_list) > 0) {
241
            foreach ($appendix_list as $key => $appendix) {
242
                $tmp_filehandler = new Ilib_Filehandler($this->kernel, $appendix['file_handler_id']);
243
                $this->value['pictures'][$key]['id']                   = $appendix['file_handler_id'];
244
                $this->value['pictures'][$key]['original']['icon_uri'] = $tmp_filehandler->get('icon_uri');
245
                $this->value['pictures'][$key]['original']['name']     = $tmp_filehandler->get('file_name');
246
                $this->value['pictures'][$key]['original']['width']    = $tmp_filehandler->get('width');
247
                $this->value['pictures'][$key]['original']['height']   = $tmp_filehandler->get('height');
248
                $this->value['pictures'][$key]['original']['file_uri'] = $tmp_filehandler->get('file_uri');
249
                $this->value['pictures'][$key]['appended_file_id']     = $appendix['id'];
250
251
                if ($tmp_filehandler->get('is_image')) {
252
                    $tmp_filehandler->createInstance();
253
                    $instances = $tmp_filehandler->instance->getList('include_hidden');
254
                    foreach ($instances as $instance) {
255
                        $this->value['pictures'][$key][$instance['name']]['file_uri'] = $instance['file_uri'];
256
                        $this->value['pictures'][$key][$instance['name']]['name']     = $instance['name'];
257
                        $this->value['pictures'][$key][$instance['name']]['width']    = $instance['width'];
258
                        $this->value['pictures'][$key][$instance['name']]['height']   = $instance['height'];
259
                    }
260
                }
261
            }
262
        }
263
        return $this->value['pictures'];
264
    }
265
266
    /**
@@ 282-308 (lines=27) @@
279
280
        $this->value['pictures'] = array();
281
282
        if (count($appendix_list) > 0) {
283
            foreach ($appendix_list as $key => $appendix) {
284
                $tmp_filehandler = new FileHandler($this->kernel, $appendix['file_handler_id']);
285
                $this->value['pictures'][$key]['id']                   = $appendix['file_handler_id'];
286
                $this->value['pictures'][$key]['original']['icon_uri'] = $tmp_filehandler->get('icon_uri');
287
                $this->value['pictures'][$key]['original']['name']     = $tmp_filehandler->get('file_name');
288
                $this->value['pictures'][$key]['original']['width']    = $tmp_filehandler->get('width');
289
                $this->value['pictures'][$key]['original']['height']   = $tmp_filehandler->get('height');
290
                $this->value['pictures'][$key]['original']['file_uri'] = $tmp_filehandler->get('file_uri');
291
                $this->value['pictures'][$key]['appended_file_id']     = $appendix['id'];
292
293
                if ($tmp_filehandler->get('is_image')) {
294
                    $tmp_filehandler->createInstance();
295
                    $instances = $tmp_filehandler->instance->getList('include_hidden');
296
                    foreach ($instances as $instance) {
297
                        $this->value['pictures'][$key][$instance['name']]['file_uri'] = $instance['file_uri'];
298
                        $this->value['pictures'][$key][$instance['name']]['name']     = $instance['name'];
299
                        $this->value['pictures'][$key][$instance['name']]['width']    = $instance['width'];
300
                        $this->value['pictures'][$key][$instance['name']]['height']   = $instance['height'];
301
                    }
302
                }
303
                $tmp_filehandler->__destruct();
304
                unset($tmp_filehandler);
305
            }
306
        }
307
        return $this->value['pictures'];
308
    }
309
310
    /**
311
     * Validates