src/WooCommerce/Invoice/CreatorPluginSupport.php
protected function &getParentBundle(array &$lines, $parentId)
    {
        foreach ($lines as &$line) {
            if (!empty($line[Meta::BundleId]) && $line[Meta::BundleId] === $parentId) {
                return $line;
            } elseif (!empty($line[Meta::ChildrenLines])) {
                // Recursively search for the parent bundle.
                $parent = &$this->getParentBundle($line[Meta::ChildrenLines], $parentId);
                if ($parent !== null) {
                    return $parent;
                }
            }
        }
        // Not found.
        return null;
    }
protected function &getParentBundle(array &$lines, $parentId)
    {
        foreach ($lines as &$line) {
            if (!empty($line[Meta::BundleId]) && $line[Meta::BundleId] === $parentId) {
                return $line;
            } elseif (!empty($line[Meta::ChildrenLines])) {
                // Recursively search for the parent bundle.
                $parent = &$this->getParentBundle($line[Meta::ChildrenLines], $parentId);
                if ($parent !== null) {
                    return $parent;
                }
            }
        }
        // Not found.
        return null;
    }
protected function & getParentBundle ( array & $ lines , $ parentId ) { foreach ( $ lines as & $ line ) { if ( ! empty ( $ line [ Meta :: BundleId ] ) && $ line [ Meta :: BundleId ] === $ parentId ) { return $ line ; } elseif ( ! empty ( $ line [ Meta :: ChildrenLines ] ) ) { // Recursively search for the parent bundle. $ parent = & $ this -> getParentBundle ( $ line [ Meta :: ChildrenLines ] , $ parentId ) ; if ( $ parent !== null ) { return $ parent ; } } } // Not found. return null ; }
Searches for, and returns by reference, the parent bundle line.

@param array $lines
The lines to search for the parent bundle line.
@param $parentId
The meta-bundle-id value to search for.

@return array|null
The parent bundle line or null if not found.
Searches for and returns by reference the parent bundle line .