Service/Calc/Bonus/Personal.php
private function calcBonus($dwnlCurrent, $dwnlCompress, $levels)
    {
        $result = [];
        $mapCustomer = $this->hlpDwnlTree->mapById($dwnlCurrent, ECustomer::A_CUSTOMER_REF);
        /** @var \Praxigento\BonusHybrid\Repo\Data\Downline $one */
        foreach ($dwnlCompress as $one) {
            $custId = $one->getCustomerRef();
            $pvValue = $one->getPv();
            $customer = $mapCustomer[$custId];
            $scheme = $this->hlpScheme->getSchemeByCustomer($customer);
            if ($scheme == Cfg::SCHEMA_DEFAULT) {
                $bonusValue = $this->hlpCalc->calcForLevelPercent($pvValue, $levels);
                if ($bonusValue > 0) {
                    $entry = new DBonus();
                    $entry->setCustomerRef($custId);
                    $entry->setValue($bonusValue);
                    $result[] = $entry;
                }
            }
        }
        return $result;
    }
private function calcBonus($dwnlCurrent, $dwnlCompress, $levels)
    {
        $result = [];
        $mapCustomer = $this->hlpDwnlTree->mapById($dwnlCurrent, ECustomer::A_CUSTOMER_REF);
        /** @var \Praxigento\BonusHybrid\Repo\Data\Downline $one */
        foreach ($dwnlCompress as $one) {
            $custId = $one->getCustomerRef();
            $pvValue = $one->getPv();
            $customer = $mapCustomer[$custId];
            $scheme = $this->hlpScheme->getSchemeByCustomer($customer);
            if ($scheme == Cfg::SCHEMA_DEFAULT) {
                $bonusValue = $this->hlpCalc->calcForLevelPercent($pvValue, $levels);
                if ($bonusValue > 0) {
                    $entry = new DBonus();
                    $entry->setCustomerRef($custId);
                    $entry->setValue($bonusValue);
                    $result[] = $entry;
                }
            }
        }
        return $result;
    }
Walk through the compressed downline tree and calculate Personal bonus for DEFAULT scheme.

@param \Praxigento\Downline\Repo\Data\Customer[] $dwnlCurrent
@param \Praxigento\BonusHybrid\Repo\Data\Downline[] $dwnlCompress
@param array $levels percents for bonus levels ([level=>percent])

@return DBonus[]