Code Duplication    Length = 6-7 lines in 6 locations

typo3/sysext/backend/Classes/Form/FormDataProvider/TcaCheckboxItems.php 2 locations

@@ 52-57 (lines=6) @@
49
            // Sanitize items
50
            $newItems = [];
51
            foreach ($items as $itemKey => $itemValue) {
52
                if (!is_array($itemValue)) {
53
                    throw new \UnexpectedValueException(
54
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' is no array as exepcted',
55
                        1440499337
56
                    );
57
                }
58
                if (!array_key_exists(0, $itemValue)) {
59
                    throw new \UnexpectedValueException(
60
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' has no label',
@@ 58-63 (lines=6) @@
55
                        1440499337
56
                    );
57
                }
58
                if (!array_key_exists(0, $itemValue)) {
59
                    throw new \UnexpectedValueException(
60
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' has no label',
61
                        1440499338
62
                    );
63
                }
64
                if (!array_key_exists(1, $itemValue)) {
65
                    $itemValue[1] = '';
66
                }

typo3/sysext/backend/Classes/Form/FormDataProvider/TcaRadioItems.php 3 locations

@@ 55-60 (lines=6) @@
52
            // Sanitize items and translate labels
53
            $newItems = [];
54
            foreach ($items as $itemKey => $itemValue) {
55
                if (!is_array($itemValue)) {
56
                    throw new \UnexpectedValueException(
57
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' is no array as exepcted',
58
                        1438607163
59
                    );
60
                }
61
                if (!array_key_exists(0, $itemValue)) {
62
                    throw new \UnexpectedValueException(
63
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' has no label',
@@ 61-66 (lines=6) @@
58
                        1438607163
59
                    );
60
                }
61
                if (!array_key_exists(0, $itemValue)) {
62
                    throw new \UnexpectedValueException(
63
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' has no label',
64
                        1438607164
65
                    );
66
                }
67
                if (!array_key_exists(1, $itemValue)) {
68
                    throw new \UnexpectedValueException(
69
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' has no value',
@@ 67-72 (lines=6) @@
64
                        1438607164
65
                    );
66
                }
67
                if (!array_key_exists(1, $itemValue)) {
68
                    throw new \UnexpectedValueException(
69
                        'Item ' . $itemKey . ' of field ' . $fieldName . ' of TCA table ' . $result['tableName'] . ' has no value',
70
                        1438607165
71
                    );
72
                }
73
                $newItems[$itemKey] = [
74
                    $languageService->sL(trim($itemValue[0])),
75
                    $itemValue[1]

typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php 1 location

@@ 446-452 (lines=7) @@
443
444
        $foreignTable = $result['processedTca']['columns'][$fieldName]['config']['foreign_table'];
445
446
        if (!is_array($GLOBALS['TCA'][$foreignTable])) {
447
            throw new \UnexpectedValueException(
448
                'Field ' . $fieldName . ' of table ' . $result['tableName'] . ' reference to foreign table '
449
                . $foreignTable . ', but this table is not defined in TCA',
450
                1439569743
451
            );
452
        }
453
454
        $queryBuilder = $this->buildForeignTableQueryBuilder($result, $fieldName);
455
        try {