private static function getMatching(array &$item, string $itemUuid, callable $callable = null, array &$collection)
    {
        // Return true if this item is the one we are looking for.
        if (isset($item['uuid']) && $item['uuid'] === $itemUuid) {
            if ($callable) {
                $callable($item, $collection);
            }

            return $item;
        }

        // Look in child items.
        if (isset($item['items']) && \is_array($item['items'])) {
            foreach ($item['items'] as &$subItem) {
                if ($c = self::getMatching($subItem, $itemUuid, $callable, $item['items'])) {
                    return $c;
                }
            }
        }

        return false;
    }
private static function getMatching(array &$item, string $itemUuid, callable $callable = null, array &$collection)
    {
        // Return true if this item is the one we are looking for.
        if (isset($item['uuid']) && $item['uuid'] === $itemUuid) {
            if ($callable) {
                $callable($item, $collection);
            }

            return $item;
        }

        // Look in child items.
        if (isset($item['items']) && \is_array($item['items'])) {
            foreach ($item['items'] as &$subItem) {
                if ($c = self::getMatching($subItem, $itemUuid, $callable, $item['items'])) {
                    return $c;
                }
            }
        }

        return false;
    }
private static function getMatching ( array & $ item , string $ itemUuid , callable $ callable = null , array & $ collection ) { // Return true if this item is the one we are looking for. if ( isset ( $ item [ 'uuid' ] ) && $ item [ 'uuid' ] === $ itemUuid ) { if ( $ callable ) { $ callable ( $ item , $ collection ) ; } return $ item ; } // Look in child items. if ( isset ( $ item [ 'items' ] ) && \ is_array ( $ item [ 'items' ] ) ) { foreach ( $ item [ 'items' ] as & $ subItem ) { if ( $ c = self :: getMatching ( $ subItem , $ itemUuid , $ callable , $ item [ 'items' ] ) ) { return $ c ; } } } return false ; }
Checks of the provided item matches or its child items.

@param array    $item
@param string   $itemUuid
@param callable $callable
@param array    $collection

@return mixed
Checks of the provided item matches or its child items .