Code Duplication    Length = 10-10 lines in 2 locations

src/Traits/MultiUnitSupport.php 2 locations

@@ 180-189 (lines=10) @@
177
    {
178
        if ($this->isMultiUnitField($field)) {
179
            $found = false;
180
            foreach ($this->getMultiUnitFieldSupportedUnits($field) as $unitClass) {
181
                /**
182
                 * @var AbstractUnit $unit
183
                 */
184
                $supportedUnit = new $unitClass();
185
                if (strtolower($supportedUnit->getId()) == strtolower($unit)) {
186
                    $found = true;
187
                    break;
188
                }
189
            }
190
            if ($found) {
191
                $this->multiUnitSelectedUnits[$field] = $unitClass;
192
            } else {
@@ 215-224 (lines=10) @@
212
                if (is_null($unit)) {
213
                    $unit = $this->getMultiUnitFieldUnit($field);
214
                } else {
215
                    foreach ($this->getMultiUnitFieldSupportedUnits($field) as $unitClass) {
216
                        /**
217
                         * @var AbstractUnit $unit
218
                         */
219
                        $supportedUnit = new $unitClass();
220
                        if (strtolower($supportedUnit->getId()) == strtolower($unit)) {
221
                            $unit = $supportedUnit;
222
                            break;
223
                        }
224
                    }
225
                }
226
                if (is_string($unit)) {
227
                    throw new NotSupportedMultiUnitField($field);