Code Duplication    Length = 32-33 lines in 2 locations

src/Intraface/modules/product/Product/Details.php 1 location

@@ 317-349 (lines=33) @@
314
     *
315
     * @return array
316
     */
317
    public static function getUnits($key = null)
318
    {
319
        $units = array(
320
            1 => array('singular' => '',
321
                      'plural' => '',
322
                      'combined' => ''),
323
            2 => array('singular' => 'unit',
324
                      'plural' => 'units',
325
                      'combined' => 'unit(s)'),
326
            3 => array('singular' => 'day',
327
                      'plural' => 'days',
328
                      'combined' => 'day(s)'),
329
            4 => array('singular' => 'month (singular)',
330
                      'plural' => 'month (plural)',
331
                      'combined' => 'month (combined)'),
332
            5 => array('singular' => 'year',
333
                      'plural' => 'years',
334
                      'combined' => 'year(s)'),
335
            6 => array('singular' => 'hour',
336
                      'plural' => 'hours',
337
                      'combined' => 'hour(s)')
338
        );
339
340
        if ($key === null) {
341
            return $units;
342
        } else {
343
            if (!empty($units[$key])) {
344
                return $units[$key];
345
            } else {
346
                return '';
347
            }
348
        }
349
    }
350
351
    /**
352
     * Returns the unit of the product

src/Intraface/modules/product/ProductDetail.php 1 location

@@ 339-370 (lines=32) @@
336
     *
337
     * @return array
338
     */
339
    public static function getUnits($key = null)
340
    {
341
        $units = array(1 => array('singular' => '',
342
                                  'plural' => '',
343
                                  'combined' => ''),
344
                       2 => array('singular' => 'unit',
345
                                  'plural' => 'units',
346
                                  'combined' => 'unit(s)'),
347
                       3 => array('singular' => 'day',
348
                                  'plural' => 'days',
349
                                  'combined' => 'day(s)'),
350
                       4 => array('singular' => 'month (singular)',
351
                                  'plural' => 'month (plural)',
352
                                  'combined' => 'month (combined)'),
353
                       5 => array('singular' => 'year',
354
                                  'plural' => 'years',
355
                                  'combined' => 'year(s)'),
356
                       6 => array('singular' => 'hour',
357
                                  'plural' => 'hours',
358
                                  'combined' => 'hour(s)')
359
                 );
360
361
        if ($key === null) {
362
            return $units;
363
        } else {
364
            if (!empty($units[$key])) {
365
                return $units[$key];
366
            } else {
367
                return '';
368
            }
369
        }
370
    }
371
372
    function setStateAccountId($id)
373
    {