Code Duplication    Length = 13-13 lines in 2 locations

src/delivery/web/fields/EnumerationField.php 1 location

@@ 53-65 (lines=13) @@
50
        ], $this->renderOptions($parameter, $value));
51
    }
52
53
    private function renderOptions(Parameter $parameter, $value) {
54
        $options = [];
55
        foreach ($this->getOptions($parameter) as $key => $caption) {
56
            $options[] = new Element('option', array_merge([
57
                'value' => $key
58
            ], $key == $value ? [
59
                'selected' => 'selected'
60
            ] : []), [
61
                $caption
62
            ]);
63
        }
64
        return $options;
65
    }
66
67
    /**
68
     * @param Parameter $parameter

src/delivery/web/fields/MultiField.php 1 location

@@ 100-112 (lines=13) @@
97
        return $ownElements;
98
    }
99
100
    private function getOptions(Parameter $parameter, $value, $id) {
101
        $options = [];
102
        foreach ($this->getTypes($parameter) as $i => $type) {
103
            $options[] = new Element('option', array_merge([
104
                'value' => "$id-multi-option-$i"
105
            ], $type->is($value) ? [
106
                'selected' => 'selected'
107
            ] : []), [
108
                $this->toString($type)
109
            ]);
110
        }
111
        return $options;
112
    }
113
114
    private function toString(Type $type) {
115
        if ($type instanceof ClassType) {