TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Core\Utility\ArrayUtility Class Reference

Static Public Member Functions

static assertAllArrayKeysAreValid (array $arrayToTest, array $allowedArrayKeys)
 
static convertBooleanStringsToBooleanRecursive (array $array)
 
static filterByValueRecursive ($needle='', array $haystack=[])
 
static isValidPath (array $array, $path, $delimiter='/')
 
static getValueByPath (array $array, $path, $delimiter='/')
 
static reIndexNumericArrayKeysRecursive (array $array)
 
static removeNullValuesRecursive (array $array)
 
static setValueByPath (array $array, $path, $value, $delimiter='/')
 
static removeByPath (array $array, $path, $delimiter='/')
 
static sortByKeyRecursive (array $array)
 
static sortArraysByKey (array $arrays, $key, $ascending=true)
 
static arrayExport (array $array=[], $level=0)
 
static flatten (array $array, $prefix='')
 
static intersectRecursive (array $source, array $mask=[])
 
static renumberKeysToAvoidLeapsIfKeysAreAllNumeric (array $array=[], $level=0)
 
static mergeRecursiveWithOverrule (array &$original, array $overrule, $addKeys=true, $includeEmptyValues=true, $enableUnsetFeature=true)
 
static inArray (array $in_array, $item)
 
static removeArrayEntryByValue (array $array, $cmpValue)
 
static keepItemsInArray (array $array, $keepItems, $getValueFunc=null)
 
static remapArrayKeys (array &$array, array $mappingTable)
 
static arrayDiffAssocRecursive (array $array1, array $array2)
 
static naturalKeySortRecursive (array &$array)
 
static filterAndSortByNumericKeys ($setupArr, $acceptAnyKeys=false)
 
static sortArrayWithIntegerKeys (array $array)
 
static sortArrayWithIntegerKeysRecursive (array $array)
 
static stripTagsFromValuesRecursive (array $array)
 

Detailed Description

Class with helper functions for array handling

Definition at line 20 of file ArrayUtility.php.

Member Function Documentation

◆ arrayDiffAssocRecursive()

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

◆ arrayExport()

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

◆ assertAllArrayKeysAreValid()

◆ convertBooleanStringsToBooleanRecursive()

static 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 51 of file ArrayUtility.php.

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

◆ filterAndSortByNumericKeys()

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

◆ filterByValueRecursive()

static 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$needleThe value to search for
array$haystackThe array in which to search
Returns
array $haystack array reduced matching $needle values

Definition at line 101 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().

◆ flatten()

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

Converts a multidimensional array to a flat representation.

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$arrayThe (relative) array to be converted
string$prefixThe (relative) prefix to be used (e.g. 'section.')
Returns
array

Definition at line 476 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Form\Domain\Configuration\ArrayProcessing\ArrayProcessor\__construct(), TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility\convertNestedToValuedConfiguration(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\flattenCalculatesExpectedResult(), TYPO3\CMS\Backend\Provider\PageTsBackendLayoutDataProvider\generateBackendLayoutFromTsConfig(), and TYPO3\CMS\Extensionmanager\Domain\Repository\ConfigurationItemRepository\mergeWithExistingConfiguration().

◆ getValueByPath()

static 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$arrayInput array
array | string$pathPath within the array
string$delimiterDefined path delimiter, default /
Returns
mixed
Exceptions

Definition at line 178 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\PropertyCollectionElement\IsCreatablePropertyCollectionElementExtractor\__invoke(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Converters\AddHmacDataConverter\__invoke(), TYPO3\CMS\Form\Domain\Finishers\FinisherVariableProvider\exists(), TYPO3\CMS\Form\Domain\Finishers\FinisherVariableProvider\get(), TYPO3\CMS\Form\Hooks\DataStructureIdentifierHook\getAdditionalFinisherSheets(), TYPO3\CMS\Core\Configuration\ConfigurationManager\getConfigurationValueByPath(), TYPO3\CMS\Core\Configuration\ConfigurationManager\getDefaultConfigurationValueByPath(), TYPO3\CMS\Form\Domain\Runtime\FormState\getFormValue(), TYPO3\CMS\Backend\View\BackendLayoutView\getIdentifiersToBeExcluded(), TYPO3\CMS\Core\Configuration\ConfigurationManager\getLocalConfigurationValueByPath(), TYPO3\CMS\Form\Domain\Configuration\FrameworkConfiguration\Extractors\FormElement\PropertyPathsExtractor\getPropertyPaths(), 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\Form\Domain\Runtime\FormRuntime\mapAndValidatePage(), TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher\parseOption(), TYPO3\CMS\Form\Controller\FormEditorController\transformMultiValueElementsForFormEditor(), TYPO3\CMS\Form\Service\TranslationService\translateFormElementValue(), TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder\untangleFilesArray(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ElementBasedValidator\validateFormElementPropertyValueByHmacData(), and TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CollectionBasedValidator\validatePropertyCollectionElementPropertyValueByHmacData().

◆ inArray()

static TYPO3\CMS\Core\Utility\ArrayUtility::inArray ( array  $in_array,
  $item 
)
static

Check if an string item exists in an array. Please note that the order of function parameters is reverse compared to the PHP function in_array()!!!

Comparison to PHP in_array(): -> $array = array(0, 1, 2, 3); -> variant_a := ::inArray($array, $needle) -> variant_b := in_array($needle, $array) -> variant_c := in_array($needle, $array, TRUE) +------—+--------—+--------—+--------—+ | $needle | variant_a | variant_b | variant_c | +------—+--------—+--------—+--------—+ | '1a' | FALSE | TRUE | FALSE | | '' | FALSE | TRUE | FALSE | | '0' | TRUE | TRUE | FALSE | | 0 | TRUE | TRUE | TRUE | +------—+--------—+--------—+--------—+

Parameters
array$in_arrayOne-dimensional array of items
string$itemItem to check for
Returns
bool TRUE if $item is in the one-dimensional array $in_array
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9, use in_array instead

Definition at line 656 of file ArrayUtility.php.

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

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

◆ intersectRecursive()

static 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$sourceSource array
array$maskArray 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 526 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Felogin\Controller\FrontendLoginController\getPreserveGetVars(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\intersectRecursiveCalculatesExpectedResult(), and TYPO3\CMS\Lowlevel\View\ConfigurationView\menuConfig().

◆ isValidPath()

static 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$arrayGiven array
string$pathPath to test, 'foo/bar/foobar'
string$delimiterDelimiter for path, default /
Returns
bool TRUE if path exists in array

Definition at line 141 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\Backend\View\BackendLayoutView\getIdentifiersToBeExcluded(), TYPO3\CMS\Form\Domain\Configuration\ConfigurationService\isFormElementTypeDefinedInFormSetup(), TYPO3\CMS\Core\Configuration\ConfigurationManager\isValidLocalConfigurationPath(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\isValidPathReturnsFalseIfPathDoesNotExist(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\isValidPathReturnsTrueIfPathExists(), TYPO3\CMS\Core\Configuration\ConfigurationManager\removeLocalConfigurationKeysByPath(), TYPO3\CMS\Form\Controller\FormEditorController\transformMultiValueElementsForFormEditor(), TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ElementBasedValidator\validateFormElementPropertyValueByHmacData(), and TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CollectionBasedValidator\validatePropertyCollectionElementPropertyValueByHmacData().

◆ keepItemsInArray()

static 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$arrayThe initial array to be filtered/reduced
mixed$keepItemsThe items which are allowed/kept in the array - accepts array or csv string
string$getValueFunc(optional) Callback function used to get the value to keep
Returns
array The filtered/reduced array with the kept items

Definition at line 709 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$originalOriginal array. It will be modified by this method and contains the result afterwards!
array$overruleOverrule array, overruling the original array
bool$addKeysIf 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$includeEmptyValuesIf set, values from $overrule will overrule if they are empty or zero.
bool$enableUnsetFeatureIf set, special values "__UNSET" can be used in the overrule array in order to unset array keys in the original array.

Definition at line 611 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver\__construct(), TYPO3\CMS\Backend\Template\DocumentTemplate\__construct(), TYPO3\CMS\Core\Utility\GeneralUtility\_GETset(), TYPO3\CMS\Core\Utility\GeneralUtility\_GPmerged(), TYPO3\CMS\Backend\Form\FormDataProvider\PageTsConfigMerged\addData(), TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaSelectItemsTest\addDataReplacesMarkersInForeignTableClauseDataProvider(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\addExtJSModule(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\addParams(), TYPO3\CMS\Core\Page\PageRenderer\addRequireJsConfiguration(), TYPO3\CMS\Core\Resource\Collection\FileCollectionRegistry\addTypeToTCA(), TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder\buildBackendUri(), TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory\buildDataMap(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValue_flex_procInData_travDS(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForFlex(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValueForText(), TYPO3\CMS\Backend\Controller\FormFlexAjaxController\containerAdd(), TYPO3\CMS\Form\Domain\Model\FormDefinition\createFinisher(), TYPO3\CMS\Core\Configuration\ConfigurationManager\createLocalConfigurationFromFactoryConfiguration(), TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\createValidator(), TYPO3\CMS\Extensionmanager\Controller\ConfigurationController\emitAfterExtensionConfigurationWriteSignal(), TYPO3\CMS\Core\Configuration\ConfigurationManager\exportConfiguration(), TYPO3\CMS\Core\TypoScript\ConfigurationForm\ext_mergeIncomingWithExisting(), TYPO3\CMS\Core\DataHandling\DataHandler\fillInFieldArray(), TYPO3\CMS\Extensionmanager\Domain\Repository\ConfigurationItemRepository\findByExtensionKey(), TYPO3\CMS\Backend\Controller\File\ThumbnailController\generateThumbnail(), TYPO3\CMS\Form\Hooks\DataStructureIdentifierHook\getAdditionalFinisherSheets(), TYPO3\CMS\Core\DataHandling\DataHandler\getCheckModifyAccessListHookObjects(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\getConfigArray(), TYPO3\CMS\Core\Configuration\Richtext\getConfiguration(), TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager\getConfiguration(), TYPO3\CMS\Backend\Controller\Wizard\SuggestWizardController\getConfigurationForTable(), TYPO3\CMS\Core\Configuration\ConfigurationManager\getConfigurationValueByPath(), TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility\getCurrentConfiguration(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getData(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\getFileFieldTCAConfig(), TYPO3\CMS\Backend\Utility\BackendUtility\getModTSconfig(), TYPO3\CMS\Backend\Utility\BackendUtility\getPagesTSconfig(), TYPO3\CMS\Core\Configuration\Richtext\getPageTsConfiguration(), TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser\getParsedData(), TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager\getPluginConfiguration(), TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager\getPluginConfiguration(), TYPO3\CMS\Core\Resource\FileReference\getProperties(), TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\getQueryArguments(), TYPO3\CMS\Backend\Controller\AbstractFormEngineAjaxController\getRelativePathToStylesheetFile(), TYPO3\CMS\Core\DataHandling\DataHandler\getTableEntries(), TYPO3\CMS\Core\Category\CategoryRegistry\getTcaFieldConfiguration(), TYPO3\CMS\Backend\Utility\BackendUtility\getTCEFORM_TSconfig(), TYPO3\CMS\Backend\Module\AbstractFunctionModule\incLocalLang(), TYPO3\CMS\Core\Page\PageRenderer\includeLanguageFileForInline(), TYPO3\CMS\Lang\LanguageService\includeLLFile(), TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController\init(), TYPO3\CMS\Fluid\ViewHelpers\Be\Widget\Controller\PaginateController\initializeAction(), TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\PaginateController\initializeAction(), TYPO3\CMS\Core\Utility\GeneralUtility\linkThisUrl(), TYPO3\CMS\Linkvalidator\Task\ValidatorTask\loadModTsConfig(), TYPO3\CMS\Core\Localization\LocalizationFactory\localizationOverride(), TYPO3\CMS\Lowlevel\View\ConfigurationView\menuConfig(), 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\Version\DataHandler\CommandMap\mergeToBottom(), TYPO3\CMS\Version\DataHandler\CommandMap\mergeToTop(), TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase\mergeToVfsContents(), TYPO3\CMS\Extensionmanager\Domain\Repository\ConfigurationItemRepository\mergeWithExistingConfiguration(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\mergingWithGetVars(), 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\Tests\Unit\Resource\ResourceStorageTest\prepareSubject(), TYPO3\CMS\Core\TypoScript\TemplateService\processIncludes(), TYPO3\CMS\Extbase\Utility\ExtensionUtility\registerModule(), TYPO3\CMS\Backend\Form\Container\AbstractContainer\renderFieldControl(), TYPO3\CMS\Backend\Form\Element\AbstractFormElement\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\Form\ViewHelpers\RenderViewHelper\renderStatic(), TYPO3\CMS\Backend\Utility\BackendUtility\RTEsetup(), TYPO3\CMS\Scheduler\Controller\SchedulerModuleController\setNextExecutionTimeAction(), TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\setOptions(), TYPO3\CMS\Form\Domain\Model\FormDefinition\setOptions(), TYPO3\CMS\Form\Domain\Model\FormElements\Section\setProperty(), TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement\setProperty(), TYPO3\CMS\Core\Database\SoftReferenceIndex\setTypoLinkPartsElement(), TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\sL(), TYPO3\CMS\Core\Configuration\ConfigurationManager\updateLocalConfiguration(), and TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder\uriFor().

◆ naturalKeySortRecursive()

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

Sorts an array by key recursive - uses natural sort order (aAbB-zZ)

Parameters
array$arrayarray to be sorted recursively, passed by reference
Returns
bool always TRUE

Definition at line 783 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Lowlevel\View\ConfigurationView\menuConfig(), TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\naturalKeySortRecursiveSortsMultiDimensionalArrayByNaturalOrder(), and TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\naturalKeySortRecursiveSortsOneDimensionalArrayByNaturalOrder().

◆ reIndexNumericArrayKeysRecursive()

static 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$arrayArray by reference which should be remapped
array$mappingTableArray with remap information, array/$oldKey => $newKey)

Definition at line 741 of file ArrayUtility.php.

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

◆ removeArrayEntryByValue()

static 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$arrayArray containing the values
string$cmpValueValue 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 674 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Core\DataHandling\DataHandler\applyFiltersToValues(), 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\Controller\UserSettingsController\removeFromList().

◆ removeByPath()

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

◆ removeNullValuesRecursive()

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

Recursively remove keys if their value are NULL.

Parameters
array$array
Returns
array the modified array

Definition at line 229 of file ArrayUtility.php.

Referenced by TYPO3\CMS\Form\Mvc\Configuration\ConfigurationManager\getConfigurationFromYamlFile(), and TYPO3\CMS\Core\Tests\Unit\Utility\ArrayUtilityTest\removeNullValuesRecursiveExpectRemoval().

◆ renumberKeysToAvoidLeapsIfKeysAreAllNumeric()

static 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$arrayInput array
int$levelInternal level used for recursion, do not set from outside!
Returns
array

Definition at line 570 of file ArrayUtility.php.

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

◆ setValueByPath()

static 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$arrayInput array to manipulate
string | array$pathPath in array to search for
mixed$valueValue to set at path location in array
string$delimiterPath delimiter
Returns
array Modified array
Exceptions

Definition at line 268 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\Model\FormDefinition\addElementDefaultValue(), TYPO3\CMS\Form\Domain\Finishers\FinisherVariableProvider\addOrUpdate(), TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility\convertValuedToNestedConfiguration(), TYPO3\CMS\Form\Domain\Runtime\FormState\setFormValue(), TYPO3\CMS\Core\Configuration\ConfigurationManager\setLocalConfigurationValueByPath(), TYPO3\CMS\Core\Configuration\ConfigurationManager\setLocalConfigurationValuesByPathValuePairs(), 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\transformMultiValueElementsForFormEditor(), TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder\untangleFilesArray(), and TYPO3\CMS\Core\DataHandling\DataHandler\updateFlexFormData().

◆ sortArraysByKey()

static 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$arraysArray of arrays to sort
string$keyKey to sort after
bool$ascendingSet to TRUE for ascending order, FALSE for descending order
Returns
array Array of sorted arrays
Exceptions

Definition at line 366 of file ArrayUtility.php.

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

◆ sortArrayWithIntegerKeys()

◆ sortArrayWithIntegerKeysRecursive()

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

◆ sortByKeyRecursive()

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

◆ stripTagsFromValuesRecursive()