for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Codappix\SearchCore\Utility;
/**
* Utility: Array
* @package Codappix\SearchCore\Utility
*/
class ArrayUtility
{
* Recursively removes empty array elements.
*
* @see \TYPO3\CMS\Extbase\Utility\ArrayUtility::removeEmptyElementsRecursively Removed in TYPO3 v9
public static function removeEmptyElementsRecursively(array $array): array
$result = $array;
foreach ($result as $key => $value) {
if (is_array($value)) {
$result[$key] = self::removeEmptyElementsRecursively($value);
if ($result[$key] === []) {
unset($result[$key]);
}
} elseif ($value === null) {
return $result;