Code Duplication    Length = 18-18 lines in 2 locations

class/oledrion_attributes.php 2 locations

@@ 571-588 (lines=18) @@
568
     * @param  string $optionName
569
     * @return float
570
     */
571
    public function getOptionPriceFromValue($optionName)
572
    {
573
        $ret     = 0;
574
        $format  = 's';
575
        $counter = 0;
576
        $values  = $this->getOption('attribute_values', $format);
577
        $prices  = $this->getOption('attribute_prices', $format);
578
        foreach ($values as $value) {
579
            if (xoops_trim($value) == $optionName) {
580
                if (isset($prices[$counter])) {
581
                    return (float)$prices[$counter];
582
                }
583
            }
584
            ++$counter;
585
        }
586
587
        return $ret;
588
    }
589
590
    /**
591
     * Retourne le libellé d'une option en fonction de son nom
@@ 596-613 (lines=18) @@
593
     * @param  string $optionName
594
     * @return string
595
     */
596
    public function getOptionNameFromValue($optionName)
597
    {
598
        $ret     = '';
599
        $format  = 's';
600
        $counter = 0;
601
        $values  = $this->getOption('attribute_values', $format);
602
        $names   = $this->getOption('attribute_names', $format);
603
        foreach ($values as $value) {
604
            if (xoops_trim($value) == $optionName) {
605
                if (isset($names[$counter])) {
606
                    return $names[$counter];
607
                }
608
            }
609
            ++$counter;
610
        }
611
612
        return $ret;
613
    }
614
615
    /**
616
     * Création du code html de l'attribut