Code Duplication    Length = 18-18 lines in 3 locations

Form/ChoiceList/LdapObjectChoiceList.php 3 locations

@@ 52-69 (lines=18) @@
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getChoicesForValues(array $values)
53
    {
54
        if (empty(array_filter($values))) {
55
            return [];
56
        }
57
58
        $choices = [];
59
        foreach ($values as $i => $value) {
60
            foreach ($this->ldapObjects as $ldapObject) {
61
                if ($ldapObject->has($this->id, $value)) {
62
                    $choices[$i] = $ldapObject;
63
                    break;
64
                }
65
            }
66
        }
67
68
        return $choices;
69
    }
70
71
    /**
72
     * {@inheritdoc}
@@ 91-108 (lines=18) @@
88
    /**
89
     * {@inheritdoc}
90
     */
91
    public function getIndicesForChoices(array $choices)
92
    {
93
        if (empty(array_filter($choices))) {
94
            return [];
95
        }
96
97
        $indices = [];
98
        foreach ($choices as $k => $choice) {
99
            foreach ($this->ldapObjects as $i => $ldapObject) {
100
                if ($ldapObject->has($this->id, $choice->get($this->id))) {
101
                    $indices[$k] = $i;
102
                    break;
103
                }
104
            }
105
        }
106
107
        return $indices;
108
    }
109
110
    /**
111
     * {@inheritdoc}
@@ 113-130 (lines=18) @@
110
    /**
111
     * {@inheritdoc}
112
     */
113
    public function getIndicesForValues(array $values)
114
    {
115
        if (empty(array_filter($values))) {
116
            return [];
117
        }
118
119
        $indices = [];
120
        foreach ($values as $k => $value) {
121
            foreach ($this->ldapObjects as $i => $ldapObject) {
122
                if ($ldapObject->has($this->id, $value)) {
123
                    $indices[$k] = $i;
124
                    break;
125
                }
126
            }
127
        }
128
129
        return $indices;
130
    }
131
}
132