code: private function calcOverrideBonusByRank($custId, $cfgOvr, $mapGen, $mapById)
      {
          $result = [];
          if (isset($mapGen[$custId])) {
              $generations = $mapGen[$custId];
              /* this customer has generations in downline */
              /**
               * @var int $gen
               * @var ECfgOvrd $cfgData
               */
              foreach ($cfgOvr as $gen => $cfgData) {
                  $percent = $cfgData->getPercent();
                  if ($percent > 0) {
                      if (isset($generations[$gen])) {
                          /* this generation exists for the customer */
                          $team = $mapGen[$custId][$gen];
                          foreach ($team as $childId) {
                              /** @var EBonDwnl $childData */
                              $childData = $mapById[$childId];
                              $pv = $childData->getPv();
                              $bonus = $this->hlpFormat->roundBonus($pv * $percent);
                              $this->logger->debug("Customer #$custId has '$pv' PV for '$gen' generation and '$bonus' as override bonus part from child #$childId .");
                              $resultEntry = new DBonus();
                              $resultEntry->setCustomerRef($custId);
                              $resultEntry->setDonatorRef($childId);
                              $resultEntry->setValue($bonus);
                              $result[] = $resultEntry;
                          }
                      }
                  }
              }
          }
          return $result;
      }
docs: @param $custId int Customer ID
  @param $cfgOvr array override bonus configuration parameters for the customer
  @param $mapGen array generations mapping
  @param $mapById array customer data by ID mapping
  
  @return number