Code Duplication    Length = 6-6 lines in 2 locations

src/DataFormatter.php 2 locations

@@ 291-296 (lines=6) @@
288
289
        // if custom fields are specified, only select these
290
        if (is_array($this->customFields)) {
291
            foreach ($this->customFields as $fieldName) {
292
                // @todo Possible security risk by making methods accessible - implement field-level security
293
                if ($obj->hasField($fieldName) || $obj->hasMethod("get{$fieldName}")) {
294
                    $dbFields[$fieldName] = $fieldName;
295
                }
296
            }
297
        } else {
298
            // by default, all database fields are selected
299
            $dbFields = DataObject::getSchema()->fieldSpecs(get_class($obj));
@@ 304-309 (lines=6) @@
301
        }
302
303
        if (is_array($this->customAddFields)) {
304
            foreach ($this->customAddFields as $fieldName) {
305
                // @todo Possible security risk by making methods accessible - implement field-level security
306
                if ($obj->hasField($fieldName) || $obj->hasMethod("get{$fieldName}")) {
307
                    $dbFields[$fieldName] = $fieldName;
308
                }
309
            }
310
        }
311
312
        // add default required fields