‪TYPO3CMS  11.5
TYPO3\CMS\Core\Utility\ArrayUtility Class Reference

Static Public Member Functions

static assertAllArrayKeysAreValid (array $arrayToTest, array $allowedArrayKeys)
 
static array convertBooleanStringsToBooleanRecursive (array $array)
 
static array filterByValueRecursive ($needle='', array $haystack=[])
 
static bool isValidPath (array $array, $path, $delimiter='/')
 
static mixed getValueByPath (array $array, $path, $delimiter='/')
 
static array reIndexNumericArrayKeysRecursive (array $array)
 
static array removeNullValuesRecursive (array $array)
 
static array setValueByPath (array $array, $path, $value, $delimiter='/')
 
static array removeByPath (array $array, $path, $delimiter='/')
 
static array sortByKeyRecursive (array $array)
 
static array sortArraysByKey (array $arrays, $key, $ascending=true)
 
static string arrayExport (array $array=[], $level=0)
 
static array flatten (array $array, $prefix='', bool $keepDots=false)
 
static array flattenPlain (array $array)
 
static array intersectRecursive (array $source, array $mask=[])
 
static array renumberKeysToAvoidLeapsIfKeysAreAllNumeric (array $array=[], $level=0)
 
static mergeRecursiveWithOverrule (array &$original, array $overrule, $addKeys=true, $includeEmptyValues=true, $enableUnsetFeature=true)
 
static array removeArrayEntryByValue (array $array, $cmpValue)
 
static array keepItemsInArray (array $array, $keepItems, $getValueFunc=null)
 
static remapArrayKeys (array &$array, array $mappingTable)
 
static array arrayDiffKeyRecursive (array $array1, array $array2)
 
static array arrayDiffAssocRecursive (array $array1, array $array2, bool $useArrayDiffAssocBehavior=false)
 
static bool naturalKeySortRecursive (array &$array)
 
static array filterAndSortByNumericKeys ($setupArr, $acceptAnyKeys=false)
 
static array sortArrayWithIntegerKeys (array $array)
 
static array sortArrayWithIntegerKeysRecursive (array $array)
 
static array stripTagsFromValuesRecursive (array $array)
 
static filterRecursive (array $array, ?callable $callback=null, int $mode=0)
 
static bool isAssociative (array $array)
 
static array replaceAndAppendScalarValuesRecursive (array $array1, array $array2)
 

Detailed Description

Class with helper functions for array handling

Definition at line 23 of file ArrayUtility.php.

Member Function Documentation

◆ arrayDiffAssocRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::arrayDiffAssocRecursive ( array  $array1,
array  $array2,
bool  $useArrayDiffAssocBehavior = false 
)
static

Filters values off from first array that also exist in second array. Comparison is done by keys. This method is a recursive version of php array_diff_assoc()

Parameters
array$array1‪Source array
array$array2‪Reduce source array by this array
bool$useArrayDiffAssocBehavior‪If false, the old array_diff_key() behavior is kept and a deprecation warning is triggered. Will be removed in TYPO3 v12.
Returns
‪array Source array reduced by values also present in second array, indexed by key

Definition at line 795 of file ArrayUtility.php.

References TYPO3\CMS\Core\Utility\ArrayUtility\arrayDiffKeyRecursive().

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayDiffAssocRecursiveHandlesMixedArrays(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayDiffAssocRecursiveHandlesMultiDimensionalArrays(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayDiffAssocRecursiveHandlesOneDimensionalArrays(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayDiffAssocRecursiveReturnsEmptyIfEqual(), and TYPO3\CMS\Core\Database\Schema\Comparator\diffTable().

◆ arrayDiffKeyRecursive()

◆ arrayExport()

static string TYPO3\CMS\Core\Utility\ArrayUtility::arrayExport ( array  $array = [],
  $level = 0 
)
static

Exports an array as string. Similar to var_export(), but representation follows the PSR-2 and TYPO3 core CGL.

See unit tests for detailed examples

Parameters
array$array‪Array to export
int$level‪Internal level used for recursion, do not set from outside!
Returns
‪string String representation of array
Exceptions

Definition at line 402 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayExportReturnsFormattedMultidimensionalArray(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayExportReturnsKeyIndexForNonConsecutiveCountedArrays(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayExportReturnsNoKeyIndexForConsecutiveCountedArrays(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayExportReturnsNumericArrayKeys(), and TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\arrayExportThrowsExceptionIfObjectShouldBeExported().

◆ assertAllArrayKeysAreValid()

◆ convertBooleanStringsToBooleanRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::convertBooleanStringsToBooleanRecursive ( array  $array)
static

Recursively convert 'true' and 'false' strings to boolean values.

Parameters
array$array
Returns
‪array the modified array

Definition at line 54 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\convertBooleanStringsToBooleanRecursiveExpectConverting(), and TYPO3\CMS\Form\Mvc\Configuration\YamlSource\load().

◆ filterAndSortByNumericKeys()

static array TYPO3\CMS\Core\Utility\ArrayUtility::filterAndSortByNumericKeys (   $setupArr,
  $acceptAnyKeys = false 
)
static

Takes a TypoScript array as input and returns an array which contains all integer properties found which had a value (not only properties). The output array will be sorted numerically.

Parameters
array$setupArrTypoScript array with numerical array in
bool$acceptAnyKeys‪If set, then a value is not required - the properties alone will be enough.
Returns
‪array An array with all integer properties listed in numeric order.
See also
‪\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGet()
‪\TYPO3\CMS\Frontend\Imaging\GifBuilder

Definition at line 852 of file ArrayUtility.php.

References TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger().

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\filterAndSortByNumericKeysBehavesCorrectlyForAcceptAnyKeysIsFalse(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\filterAndSortByNumericKeysBehavesCorrectlyForAcceptAnyKeysIsTrue(), TYPO3\CMS\Frontend\Imaging\GifBuilder\make(), TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor\process(), TYPO3\CMS\Core\Imaging\GraphicalFunctions\splitString(), and TYPO3\CMS\Frontend\Imaging\GifBuilder\start().

◆ filterByValueRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::filterByValueRecursive (   $needle = '',
array  $haystack = [] 
)
static

Reduce an array by a search value and keep the array structure.

Comparison is type strict:

  • ‪For a given needle of type string, integer, array or boolean, value and value type must match to occur in result array
  • ‪For a given object, an object within the array must be a reference to the same object to match (not just different instance of same class)

Example:

  • ‪Needle: 'findMe'
  • ‪Given array: array( 'foo' => 'noMatch', 'bar' => 'findMe', 'foobar => array( 'foo' => 'findMe', ), );
  • ‪Result: array( 'bar' => 'findMe', 'foobar' => array( 'foo' => findMe', ), );

See the unit tests for more examples and expected behaviour

Parameters
mixed$needle‪The value to search for
array$haystack‪The array in which to search
Returns
‪array $haystack array reduced matching $needle values

Definition at line 104 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addTcaSelectItem(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\filterByValueRecursiveCorrectlyFiltersArray(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\filterByValueRecursiveDoesNotMatchDifferentInstancesOfSameClass(), and TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\filterByValueRecursiveMatchesReferencesToSameObject().

◆ filterRecursive()

static TYPO3\CMS\Core\Utility\ArrayUtility::filterRecursive ( array  $array,
?callable  $callback = null,
int  $mode = 0 
)
static

◆ flatten()

static array TYPO3\CMS\Core\Utility\ArrayUtility::flatten ( array  $array,
  $prefix = '',
bool  $keepDots = false 
)
static

Converts a multidimensional array to a flat representation.

Todo:

: The current implementation isn't a generic array flatten method, but tailored for TypoScript flattening

: It should be deprecated and removed and the required specialities should be put under the domain of TypoScript parsing

See unit tests for more details

Example:

  • ‪array: array( 'first.' => array( 'second' => 1 ) )
  • ‪result: array( 'first.second' => 1 )

Example:

  • ‪array: array( 'first' => array( 'second' => 1 ) )
  • ‪result: array( 'first.second' => 1 )
Parameters
array$array‪The (relative) array to be converted
string$prefix‪The (relative) prefix to be used (e.g. 'section.')
bool$keepDots
Returns
‪array

Definition at line 486 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\flattenCalculatesExpectedResult(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\flattenWithKeepDotsCalculatesExpectedResult(), TYPO3\CMS\Backend\Provider\PageTsBackendLayoutDataProvider\generateBackendLayoutFromTsConfig(), TYPO3\CMS\Core\TypoScript\TemplateService\generateConfig(), TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser\getConfigurationAsValuedArray(), TYPO3\CMS\Form\Tests\Functional\Framework\FormHandling\FormData\getPostStructure(), and TYPO3\CMS\Adminpanel\Modules\Info\UserIntInformation\getUserIntInfo().

◆ flattenPlain()

static array TYPO3\CMS\Core\Utility\ArrayUtility::flattenPlain ( array  $array)
static

◆ getValueByPath()

static mixed TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath ( array  $array,
  $path,
  $delimiter = '/' 
)
static

Returns a value by given path

Example

  • ‪array: array( 'foo' => array( 'bar' => array( 'baz' => 42 ) ) );
  • ‪path: foo/bar/baz
  • ‪return: 42

If a path segments contains a delimiter character, the path segment must be enclosed by " (double quote), see unit tests for details

Parameters
array$array‪Input array
array | string$path‪Path within the array
string$delimiter‪Defined path delimiter, default /
Returns
‪mixed
Exceptions

Definition at line 180 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\IsCreatableFormElementExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\MultiValuePropertiesExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\PropertyCollectionElement\MultiValuePropertiesExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\PropertyCollectionElement\PropertyPathsExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\SelectOptionsExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\PropertyCollectionElement\SelectOptionsExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\PropertyCollectionElement\IsCreatablePropertyCollectionElementExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FlexformConfiguration\Processors\FinisherOptionGenerator\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\AddHmacDataConverter\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\FinisherOptionsFlexFormOverridesConverter\__invoke(), TYPO3\CMS\Form\Domain\Finishers\FinisherVariableProvider\exists(), TYPO3\CMS\Form\Domain\Finishers\FinisherVariableProvider\get(), TYPO3\CMS\Core\Configuration\ExtensionConfiguration\get(), TYPO3\CMS\Form\Domain\Runtime\FormState\getFormValue(), TYPO3\CMS\Backend\View\BackendLayoutView\getIdentifiersToBeExcluded(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\PropertyPathsExtractor\getPropertyPaths(), TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider\DefaultFunctionsProvider\getTraverseArrayFunction(), TYPO3\CMS\Form\Mvc\Configuration\InheritancesResolverService\getValueByPath(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathAcceptsDifferentDelimiter(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathGetsCorrectValue(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathReturnsFirstIndexIfPathIsZero(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathReturnsFirstIndexIfPathSegmentIsZero(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathThrowsExceptionIfPathIsEmpty(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathThrowsExceptionIfPathIsNotString(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathThrowsExceptionIfPathNotExists(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\getValueByPathThrowsSpecificExceptionIfPathNotExists(), TYPO3\CMS\Backend\Controller\Wizard\AddController\mainAction(), TYPO3\CMS\Form\Domain\Runtime\FormRuntime\mapAndValidatePage(), TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher\parseOption(), TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\parseSiteConfiguration(), TYPO3\CMS\Backend\Controller\Wizard\EditController\processRequest(), TYPO3\CMS\Form\Controller\FormEditorController\transformMultiValuePropertiesForFormEditor(), TYPO3\CMS\Form\Service\TranslationService\translateFinisherOption(), TYPO3\CMS\Form\Service\TranslationService\translateFormElementValue(), TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder\untangleFilesArray(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ElementBasedValidator\validateFormElementPropertyValueByHmacData(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CollectionBasedValidator\validatePropertyCollectionElementPropertyValueByHmacData(), and TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\ActionControllerArgumentTest\validationErrorReturnsToForwardedPreviousAction().

◆ intersectRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::intersectRecursive ( array  $source,
array  $mask = [] 
)
static

Determine the intersections between two arrays, recursively comparing keys A complete sub array of $source will be preserved, if the key exists in $mask.

See unit tests for more examples and edge cases.

Example:

  • ‪source: array( 'key1' => 'bar', 'key2' => array( 'subkey1' => 'sub1', 'subkey2' => 'sub2', ), 'key3' => 'baz', )
  • ‪mask: array( 'key1' => NULL, 'key2' => array( 'subkey1' => exists', ), )
  • ‪return: array( 'key1' => 'bar', 'key2' => array( 'subkey1' => 'sub1', ), )
Parameters
array$source‪Source array
array$mask‪Array that has the keys which should be kept in the source array
Returns
‪array Keys which are present in both arrays with values of the source array

Definition at line 569 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\GlobalVariableProvider\getConfiguration(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\intersectRecursiveCalculatesExpectedResult(), and TYPO3\CMS\Backend\Routing\RouteRedirect\resolve().

◆ isAssociative()

static bool TYPO3\CMS\Core\Utility\ArrayUtility::isAssociative ( array  $array)
static

Check whether the array has non-integer keys. If there is at least one string key, $array will be regarded as an associative array.

Parameters
array$array
Returns
‪bool True in case a string key was found.

Definition at line 953 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\isAssociativeCorrectlyFindsStringKeys().

◆ isValidPath()

static bool TYPO3\CMS\Core\Utility\ArrayUtility::isValidPath ( array  $array,
  $path,
  $delimiter = '/' 
)
static

Checks if a given path exists in array

Example:

  • ‪array: array( 'foo' => array( 'bar' = 'test', ) );
  • ‪path: 'foo/bar'
  • ‪return: TRUE
Parameters
array$array‪Given array
string$path‪Path to test, 'foo/bar/foobar'
string$delimiter‪Delimiter for path, default /
Returns
‪bool TRUE if path exists in array

Definition at line 144 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\IsCreatableFormElementExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\MultiValuePropertiesExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\PropertyCollectionElement\IsCreatablePropertyCollectionElementExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\FinisherTranslationLanguageConverter\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CreatableFormElementPropertiesValidator\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CreatablePropertyCollectionElementPropertiesValidator\__invoke(), TYPO3\CMS\Core\Configuration\ExtensionConfiguration\get(), TYPO3\CMS\Backend\View\BackendLayoutView\getIdentifiersToBeExcluded(), TYPO3\CMS\Form\Domain\Configuration\ConfigurationService\isFormElementTypeDefinedInFormSetup(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\isValidPathReturnsFalseIfPathDoesNotExist(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\isValidPathReturnsTrueIfPathExists(), TYPO3\CMS\Form\Controller\FormEditorController\transformMultiValuePropertiesForFormEditor(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ElementBasedValidator\validateFormElementPropertyValueByHmacData(), and TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CollectionBasedValidator\validatePropertyCollectionElementPropertyValueByHmacData().

◆ keepItemsInArray()

static array TYPO3\CMS\Core\Utility\ArrayUtility::keepItemsInArray ( array  $array,
  $keepItems,
  $getValueFunc = null 
)
static

Filters an array to reduce its elements to match the condition. The values in $keepItems can be optionally evaluated by a custom callback function.

Example (arguments used to call this function): $array = array( array('aa' => array('first', 'second'), array('bb' => array('third', 'fourth'), array('cc' => array('fifth', 'sixth'), ); $keepItems = array('third'); $getValueFunc = function($value) { return $value[0]; }

Returns: array( array('bb' => array('third', 'fourth'), )

Parameters
array$array‪The initial array to be filtered/reduced
mixed$keepItems‪The items which are allowed/kept in the array - accepts array or csv string
callable | null$getValueFunc‪(optional) Callback function used to get the value to keep
Returns
‪array The filtered/reduced array with the kept items

Definition at line 718 of file ArrayUtility.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\keepItemsInArrayCanUseClosure(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\keepItemsInArrayWorksWithOneArgument(), and TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider\removeItemsByKeepItemsPageTsConfig().

◆ mergeRecursiveWithOverrule()

static TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule ( array &  $original,
array  $overrule,
  $addKeys = true,
  $includeEmptyValues = true,
  $enableUnsetFeature = true 
)
static

Merges two arrays recursively and "binary safe" (integer keys are overridden as well), overruling similar values in the original array with the values of the overrule array. In case of identical keys, ie. keeping the values of the overrule array.

This method takes the original array by reference for speed optimization with large arrays

The differences to the existing PHP function array_merge_recursive() are:

  • ‪Keys of the original array can be unset via the overrule array. ($enableUnsetFeature)
  • ‪Much more control over what is actually merged. ($addKeys, $includeEmptyValues)
  • ‪Elements or the original array get overwritten if the same key is present in the overrule array.
Parameters
array$original‪Original array. It will be modified by this method and contains the result afterwards!
array$overrule‪Overrule array, overruling the original array
bool$addKeys‪If set to FALSE, keys that are NOT found in $original will not be set. Thus only existing value can/will be overruled from overrule array.
bool$includeEmptyValues‪If set, values from $overrule will overrule if they are empty or zero.
bool$enableUnsetFeature‪If set, special values "__UNSET" can be used in the overrule array in order to unset array keys in the original array.

Definition at line 654 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfigMerged\addData(), TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaSelectItemsTest\addDataReplacesMarkersInForeignTableClause(), TYPO3\CMS\Core\Page\AssetCollector\addInlineJavaScript(), TYPO3\CMS\Core\Page\AssetCollector\addInlineStyleSheet(), TYPO3\CMS\Core\Page\AssetCollector\addJavaScript(), TYPO3\CMS\Core\Page\AssetCollector\addMedia(), TYPO3\CMS\Core\Page\AssetCollector\addStyleSheet(), TYPO3\CMS\Core\Resource\Collection\FileCollectionRegistry\addTypeToTCA(), TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder\build(), TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder\buildBackendUri(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForFlex(), TYPO3\CMS\Backend\Controller\FormFlexAjaxController\containerAdd(), TYPO3\CMS\Extbase\Persistence\ClassesConfigurationFactory\createClassesConfiguration(), TYPO3\CMS\Form\Domain\Model\FormDefinition\createFinisher(), TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\createValidator(), TYPO3\CMS\Scheduler\Controller\SchedulerModuleController\editTaskAction(), TYPO3\CMS\Core\DataHandling\DataHandler\fillInFieldArray(), TYPO3\CMS\Backend\Controller\File\ThumbnailController\generateThumbnail(), TYPO3\CMS\Form\Hooks\DataStructureIdentifierHook\getAdditionalFinisherSheets(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\getConfigArray(), TYPO3\CMS\Core\Configuration\Richtext\getConfiguration(), TYPO3\CMS\Lowlevel\ConfigurationModuleProvider\GlobalVariableProvider\getConfiguration(), TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager\getConfiguration(), TYPO3\CMS\Backend\Controller\Wizard\SuggestWizardController\getConfigurationForTable(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\getFileFieldTCAConfig(), TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController\getLabelsFromLocalizationFile(), TYPO3\CMS\Core\Configuration\Richtext\getPageTsConfiguration(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\getPluginConfiguration(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getPluginConfiguration(), TYPO3\CMS\Core\Resource\FileReference\getProperties(), TYPO3\CMS\Core\DataHandling\DataHandler\getTableEntries(), TYPO3\CMS\Core\Category\CategoryRegistry\getTcaFieldConfiguration(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\loadModTSconfig(), TYPO3\CMS\Core\Localization\LocalizationFactory\localizationOverride(), TYPO3\CMS\Backend\Controller\SiteInlineAjaxController\mergeChildResultIntoJsonResult(), TYPO3\CMS\Backend\Controller\FormInlineAjaxController\mergeChildResultIntoJsonResult(), TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\mergeConfigurationIntoFrameworkConfiguration(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\mergeRecursiveWithOverruleCalculatesExpectedResult(), TYPO3\CMS\Backend\Form\FormResultCompiler\mergeResult(), TYPO3\CMS\Workspaces\DataHandler\CommandMap\mergeToBottom(), TYPO3\CMS\Workspaces\DataHandler\CommandMap\mergeToTop(), TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\mergeToVfsContents(), TYPO3\CMS\Form\Controller\FormFrontendController\overrideByTypoScriptSettings(), TYPO3\CMS\Form\Mvc\Configuration\ConfigurationManager\overrideConfigurationByTypoScript(), TYPO3\CMS\Backend\Form\Utility\FormEngineUtility\overrideFieldConf(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\overrideStoragePidIfStartingPointIsSet(), TYPO3\CMS\Form\Hooks\DataStructureIdentifierHook\parseDataStructureByIdentifierPostProcess(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_linkTP_keepPIvars(), TYPO3\CMS\Frontend\Plugin\AbstractPlugin\pi_setPiVarDefaults(), TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor\prefixLanguageTitle(), TYPO3\CMS\Core\TypoScript\Parser\ConstantConfigurationParser\prepareConfigurationForView(), TYPO3\CMS\Core\Tests\Unit\Resource\ResourceStorageTest\prepareSubject(), TYPO3\CMS\Core\DataHandling\DataHandler\process_cmdmap(), TYPO3\CMS\Core\Localization\LanguageService\readLLfile(), TYPO3\CMS\Extbase\Utility\ExtensionUtility\registerModule(), TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldControl(), TYPO3\CMS\Backend\Form\Element\AbstractFormElement\renderFieldControl(), TYPO3\CMS\Backend\Form\Element\SelectMultipleSideBySideElement\renderFieldControl(), TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldInformation(), TYPO3\CMS\Backend\Form\Element\AbstractFormElement\renderFieldInformation(), TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldWizard(), TYPO3\CMS\Backend\Form\Element\AbstractFormElement\renderFieldWizard(), TYPO3\CMS\Backend\ViewHelpers\ModuleLinkViewHelper\renderStatic(), TYPO3\CMS\Form\ViewHelpers\RenderViewHelper\renderStatic(), TYPO3\CMS\Core\DataHandling\DataHandler\resolveFieldConfigurationAndRespectColumnsOverrides(), TYPO3\CMS\Backend\Controller\Wizard\SuggestWizardController\searchAction(), TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement\setDefaultValue(), TYPO3\CMS\Form\Domain\Model\FormElements\Section\setProperty(), TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement\setProperty(), TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\setRenderingOption(), TYPO3\CMS\Backend\Controller\FormSlugAjaxController\suggestAction(), TYPO3\CMS\Core\Configuration\ExtensionConfiguration\synchronizeExtConfTemplateWithLocalConfiguration(), TYPO3\CMS\Core\Configuration\ExtensionConfiguration\synchronizeExtConfTemplateWithLocalConfigurationOfAllExtensions(), TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder\uriFor(), and TYPO3\CMS\Core\Configuration\SiteConfiguration\write().

◆ naturalKeySortRecursive()

◆ reIndexNumericArrayKeysRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::reIndexNumericArrayKeysRecursive ( array  $array)
static

◆ remapArrayKeys()

static TYPO3\CMS\Core\Utility\ArrayUtility::remapArrayKeys ( array &  $array,
array  $mappingTable 
)
static

Rename Array keys with a given mapping table

Parameters
array$array‪Array by reference which should be remapped
array$mappingTable‪Array with remap information, array/$oldKey => $newKey)

Definition at line 750 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\remapArrayKeysExchangesKeysWithGivenMapping().

◆ removeArrayEntryByValue()

static array TYPO3\CMS\Core\Utility\ArrayUtility::removeArrayEntryByValue ( array  $array,
  $cmpValue 
)
static

Removes the value $cmpValue from the $array if found there. Returns the modified array

Parameters
array$array‪Array containing the values
string$cmpValue‪Value to search for and if found remove array entry where found.
Returns
‪array Output array with entries removed if search string is found

Definition at line 683 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\checkRemoveArrayEntryByValueRemovesEntriesFromMultiDimensionalArray(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\checkRemoveArrayEntryByValueRemovesEntriesFromOneDimensionalArray(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\checkRemoveArrayEntryByValueRemovesEntryWithEmptyString(), and TYPO3\CMS\Backend\Configuration\BackendUserConfiguration\removeFromList().

◆ removeByPath()

static array TYPO3\CMS\Core\Utility\ArrayUtility::removeByPath ( array  $array,
  $path,
  $delimiter = '/' 
)
static

Remove a sub part from an array specified by path

Parameters
array$array‪Input array to manipulate
string$path‪Path to remove from array
string$delimiter‪Path delimiter
Returns
‪array Modified array
Exceptions

Definition at line 316 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\RemoveHmacDataConverter\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\FinisherTranslationLanguageConverter\__invoke(), TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\EvaluateDisplayConditionsTest\addDataRemovesTcaReferencingOtherFieldsInDisplayCondition(), TYPO3\CMS\Form\Tests\Functional\Framework\FormHandling\FormData\getPostStructure(), TYPO3\CMS\Form\Domain\Finishers\FinisherVariableProvider\remove(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathAcceptsGivenDelimiter(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathRemovesCorrectPath(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathRemovesFirstIndexWithZeroAsPath(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathRemovesFirstIndexWithZeroAsPathSegment(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathThrowsExceptionIfPathDoesNotExistInArray(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathThrowsExceptionIfPathIsEmpty(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathThrowsExceptionIfPathIsNotAString(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathThrowsExceptionWithEmptyPathSegment(), and TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeByPathThrowsSpecificExceptionIfPathDoesNotExistInArray().

◆ removeNullValuesRecursive()

◆ renumberKeysToAvoidLeapsIfKeysAreAllNumeric()

static array TYPO3\CMS\Core\Utility\ArrayUtility::renumberKeysToAvoidLeapsIfKeysAreAllNumeric ( array  $array = [],
  $level = 0 
)
static

Renumber the keys of an array to avoid leaps if keys are all numeric.

Is called recursively for nested arrays.

Example:

Given array(0 => 'Zero' 1 => 'One', 2 => 'Two', 4 => 'Three') as input, it will return array(0 => 'Zero' 1 => 'One', 2 => 'Two', 3 => 'Three')

Will treat keys string representations of number (ie. '1') equal to the numeric value (ie. 1).

Example: Given array('0' => 'Zero', '1' => 'One' ) it will return array(0 => 'Zero', 1 => 'One')

Parameters
array$array‪Input array
int$level‪Internal level used for recursion, do not set from outside!
Returns
‪array

Definition at line 613 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\renumberKeysToAvoidLeapsIfKeysAreAllNumericReturnsExpectedOrder().

◆ replaceAndAppendScalarValuesRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::replaceAndAppendScalarValuesRecursive ( array  $array1,
array  $array2 
)
static

Same as array_replace_recursive except that when in simple arrays (= YAML lists), the entries are appended (array_merge). The second array takes precedence in case of equal sub arrays.

Parameters
array$array1
array$array2
Returns
‪array

Definition at line 967 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Configuration\Loader\YamlFileLoader\processImports(), and TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\replaceAndAppendScalarValuesRecursiveCorrectlyMergesArrays().

◆ setValueByPath()

static array TYPO3\CMS\Core\Utility\ArrayUtility::setValueByPath ( array  $array,
  $path,
  $value,
  $delimiter = '/' 
)
static

Modifies or sets a new value in an array by given path

Example:

  • ‪array: array( 'foo' => array( 'bar' => 42, ), );
  • ‪path: foo/bar
  • ‪value: 23
  • ‪return: array( 'foo' => array( 'bar' => 23, ), );
Parameters
array$array‪Input array to manipulate
string | array | \ArrayAccess$path‪Path in array to search for
mixed$value‪Value to set at path location in array
string$delimiter‪Path delimiter
Returns
‪array Modified array
Exceptions

Definition at line 272 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\AddHmacDataToFormElementPropertyConverter\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\AddHmacDataToPropertyCollectionElementConverter\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\FinisherTranslationLanguageConverter\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\FinisherOptionsFlexFormOverridesConverter\__invoke(), TYPO3\CMS\Form\Domain\Model\FormDefinition\addElementDefaultValue(), TYPO3\CMS\Form\Domain\Finishers\FinisherVariableProvider\addOrUpdate(), TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools\cleanFlexFormXML_callBackFunction(), TYPO3\CMS\Install\Controller\SettingsController\extensionConfigurationWriteAction(), TYPO3\CMS\Form\Tests\Functional\Framework\FormHandling\FormData\getPostStructure(), TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\ActionControllerArgumentTest\inflateFormValues(), TYPO3\CMS\Backend\Controller\Wizard\AddController\mainAction(), TYPO3\CMS\Dashboard\WidgetRegistry\registerWidget(), TYPO3\CMS\Form\Controller\FormFrontendController\renderAction(), TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\EnhancerSiteRequest\RouteTest\routeIdentifiersAreResolved(), TYPO3\CMS\Form\Domain\Runtime\FormState\setFormValue(), TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue_dbRels(), TYPO3\CMS\Core\Database\ReferenceIndex\setReferenceValue_softreferences(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\setValueByPathCanUseZeroAsPath(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\setValueByPathCanUseZeroAsPathSegment(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\setValueByPathSetsCorrectValue(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\setValueByPathThrowsExceptionIfPathIsEmpty(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\setValueByPathThrowsExceptionIfPathIsNotAString(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\setValueByPathThrowsExceptionIfPathSegmentIsEmpty(), TYPO3\CMS\Form\Controller\FormEditorController\transformMultiValuePropertiesForFormEditor(), TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder\untangleFilesArray(), and TYPO3\CMS\Core\DataHandling\DataHandler\updateFlexFormData().

◆ sortArraysByKey()

static array TYPO3\CMS\Core\Utility\ArrayUtility::sortArraysByKey ( array  $arrays,
  $key,
  $ascending = true 
)
static

Sort an array of arrays by a given key using uasort

Parameters
array$arrays‪Array of arrays to sort
string$key‪Key to sort after
bool$ascending‪Set to TRUE for ascending order, FALSE for descending order
Returns
‪array Array of sorted arrays
Exceptions

Definition at line 374 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\sortArraysByKeyCheckIfSortingIsCorrect(), and TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\sortArraysByKeyThrowsExceptionForNonExistingKey().

◆ sortArrayWithIntegerKeys()

◆ sortArrayWithIntegerKeysRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::sortArrayWithIntegerKeysRecursive ( array  $array)
static

◆ sortByKeyRecursive()

static array TYPO3\CMS\Core\Utility\ArrayUtility::sortByKeyRecursive ( array  $array)
static

◆ stripTagsFromValuesRecursive()