Service/Calc/Bonus/Z/Proc/Compress/Phase1.php
private function rebuildTree($calcId, $compressed, $mapPlain, $keyCalcId, $keyParentId, $keyDepth, $keyPath)
    {
        $result = [];
        /** @var \Praxigento\Downline\Repo\Data\Snap $item */
        foreach ($compressed as $item) {
            $snapCustId = $item->getCustomerRef();
            $snapParentId = $item->getParentRef();
            $snapDepth = $item->getDepth();
            $snapPath = $item->getPath();
            $entry = $mapPlain[$snapCustId];
            if (is_array($entry)) {
                $entry[$keyCalcId] = $calcId;
                $entry[$keyParentId] = $snapParentId;
                $entry[$keyDepth] = $snapDepth;
                $entry[$keyPath] = $snapPath;
            } else {
                $entry->set($keyCalcId, $calcId);
                $entry->set($keyParentId, $snapParentId);
                $entry->set($keyDepth, $snapDepth);
                $entry->set($keyPath, $snapPath);
            }
            $result[$snapCustId] = $entry;
        }
        return $result;
    }
private function rebuildTree($calcId, $compressed, $mapPlain, $keyCalcId, $keyParentId, $keyDepth, $keyPath)
    {
        $result = [];
        /** @var \Praxigento\Downline\Repo\Data\Snap $item */
        foreach ($compressed as $item) {
            $snapCustId = $item->getCustomerRef();
            $snapParentId = $item->getParentRef();
            $snapDepth = $item->getDepth();
            $snapPath = $item->getPath();
            $entry = $mapPlain[$snapCustId];
            if (is_array($entry)) {
                $entry[$keyCalcId] = $calcId;
                $entry[$keyParentId] = $snapParentId;
                $entry[$keyDepth] = $snapDepth;
                $entry[$keyPath] = $snapPath;
            } else {
                $entry->set($keyCalcId, $calcId);
                $entry->set($keyParentId, $snapParentId);
                $entry->set($keyDepth, $snapDepth);
                $entry->set($keyPath, $snapPath);
            }
            $result[$snapCustId] = $entry;
        }
        return $result;
    }
private function rebuildTree ( $ calcId , $ compressed , $ mapPlain , $ keyCalcId , $ keyParentId , $ keyDepth , $ keyPath ) { $ result = [ ] ; /** @var \Praxigento\Downline\Repo\Data\Snap $item */ foreach ( $ compressed as $ item ) { $ snapCustId = $ item -> getCustomerRef ( ) ; $ snapParentId = $ item -> getParentRef ( ) ; $ snapDepth = $ item -> getDepth ( ) ; $ snapPath = $ item -> getPath ( ) ; $ entry = $ mapPlain [ $ snapCustId ] ; if ( is_array ( $ entry ) ) { $ entry [ $ keyCalcId ] = $ calcId ; $ entry [ $ keyParentId ] = $ snapParentId ; $ entry [ $ keyDepth ] = $ snapDepth ; $ entry [ $ keyPath ] = $ snapPath ; } else { $ entry -> set ( $ keyCalcId , $ calcId ) ; $ entry -> set ( $ keyParentId , $ snapParentId ) ; $ entry -> set ( $ keyDepth , $ snapDepth ) ; $ entry -> set ( $ keyPath , $ snapPath ) ; } $ result [ $ snapCustId ] = $ entry ; } return $ result ; }
Rebuild target tree from source ($mapPlain) using compressed snap data.

@param int $calcId phase1 compression calculation ID
@param \Praxigento\Downline\Repo\Data\Snap[] $compressed
@param array|\Praxigento\Core\Data[] $mapPlain
@param string $keyCalcId
@param string $keyParentId
@param string $keyDepth
@param string $keyPath
@return array|\Praxigento\Core\Data[]
Rebuild target tree from source ( $mapPlain ) using compressed snap data .