How much have to be realms increased to manage total difficulty

@return int
357836
public function getCurrentRealmsIncrement(): int
    {
        $currentDifficulty = $this->getValue();
        $maximalDifficulty = $this->getMaximal();
        if ($currentDifficulty <= $maximalDifficulty) {
            return 0;
        }
        $additionalDifficulty = $currentDifficulty - $maximalDifficulty;
        $steps = $additionalDifficulty / $this->getDifficultyAddition()->getDifficultyAdditionPerStep();
        $realmsIncrement = $steps * $this->getDifficultyAddition()->getRealmsChangePerAdditionStep();

        return (int)\ceil($realmsIncrement); // even a tiny piece of a higher realm means the lower realm is not able to create that formula
    }
153999
public function getSpeedModifier(): int
    {
        $speedBonus = 0;
        foreach ($this->combatActionCodes as $combatActionCode) {
            /** can not be combined with RUN, but that should be solved in @see validateActionCodesCoWork */
            if ($combatActionCode->getValue() === CombatActionCode::MOVE) {
                /** see PPH page 107 left column */
                $speedBonus += 8;
            }
            /** can not be combined with MOVE, but that should be solved in @see validateActionCodesCoWork */
            if ($combatActionCode->getValue() === CombatActionCode::RUN) {
                /** see PPH page 107 left column */
                $speedBonus += 22;
            }
        }

        return $speedBonus;
    }
95730
protected function whatToDoWithEntity(): int
    {
        $this->checkEntityIsInConfig();

        $entityConfig = $this->configEntities[$this->entity];

        $actions = 0;
        if (array_key_exists('cols', $entityConfig)) {
            switch ($entityConfig['action']) {
                case 'update':
                    $actions |= self::UPDATE_TABLE;
                    break;
                case 'insert':
                    $actions |= self::INSERT_TABLE;
                    break;
            }
        }

        return $actions;
    }
294292
public function getTotalCost() {
        $totalCost = $this->getCost();
        $adjustmentTotal = 0;

        foreach ($this->adjustments as $adjustment) {
            $adjustmentObject = Yii::createObject($adjustment);
            if($adjustmentObject instanceof CartSumAdjustment) {
                $adjustmentTotal += $adjustmentObject->countAdjustment($totalCost);
            }
        }

        return $totalCost + $adjustmentTotal;
    }
1038803
public function getPercentagePartial()
    {
        $total = $this->getTotal();

        return round((($this->score->getValid() + $this->score->getPartial())/$total) * 100);
    }
1006417
public function getCurrentDifficultyIncrement(): int
    {
        if ($this->getAdditionStep() === 0) { // this addition ha no steps, so can not be changed
            return 0;
        }

        return ToInteger::toInteger(\ceil($this->getCurrentAddition() / $this->getAdditionStep() * $this->getDifficultyPerAdditionStep()));
    }
1129027
public function getTotal()
    {
        return $this->score->getValid() + $this->score->getPartial() + $this->score->getNotValid();
    }
1366964
public function addOnAmount()
    {
        $totalAddOn = 0;

        foreach ($this->transaction->addOns as $addOn) {
            $totalAddOn += $addOn->amount * ($addOn->quantity ?? 1);
        }

        return (float) $totalAddOn;
    }
1095241
protected function consolidate(): int
    {
        $bytes = 0;
        if ("\n" !== $this->newline) {
            $this->document->fseek(-1, SEEK_CUR);
            $bytes = $this->document->fwrite($this->newline, strlen($this->newline)) - 1;
        }

        if (null === $this->flush_threshold) {
            return $bytes;
        }

        ++$this->flush_counter;
        if (0 === $this->flush_counter % $this->flush_threshold) {
            $this->flush_counter = 0;
            $this->document->fflush();
        }

        return $bytes;
    }
76334
public function getProgressToNextLevel()
    {
        if ($this->isTotal()) {
            return false;
        }

        $level = $this->getVirtualLevel();
        $currentLevelXp = $this->getSkill()->getXp($level);
        $nextLevelXp = $this->getSkill()->getXp($level + 1);

        if (!$nextLevelXp) {
            return false;
        }

        $totalXpInLevel = $nextLevelXp - $currentLevelXp;
        $xpInLevel = $this->getXp() - $currentLevelXp;

        return $xpInLevel / $totalXpInLevel;
    }
119593
public function total()
    {
        $response = $this->send(sprintf('subscribers_count/?api_token=%s', $this->apiToken));
        $content  = json_decode($response->getBody());

        return (integer) $content->count;
    }
232346
public function getContrast()
    {
        if (!preg_match('/^-*[0-9]+$/', $this->con)) {
            return;
        }

        if ($this->con < -100 or $this->con > 100) {
            return;
        }

        return (int) $this->con;
    }
208101
private function totalRecordsQuery(): int
    {
        return $this->totalIndividualsQuery()
            + $this->totalFamiliesQuery()
            + $this->totalNotesQuery()
            + $this->totalRepositoriesQuery()
            + $this->totalSourcesQuery();
    }
336284
public function numberOfPages(){
        if($this->totalAmount == 0){
            return 0;
        }
        $cantidad= $this->totalAmount / $this->amountPerPage;
        if(is_int($cantidad)){
            return $cantidad;
        }else{
            $cantidad_int= intval($cantidad);
            if($cantidad_int > $cantidad){
                return $cantidad_int;
            }else{
                return $cantidad_int + 1;
            }
        }
    }
586358
protected function getTotal()
	{
		if (null == $this->_total) {
			$this->_total = 0;
			foreach ($this->types as $type) {
				if (isset($type['value'])) {
					$this->_total += $type['value'];
				}
			}
		}
		return $this->_total;
	}
1100318
public function progress() : int
    {
        return $this->comparing() ?
        $this->group->comparedUser->progress :
        $this->group->fromUser->progress;
    }
656756
private function perConnMaxInFlight()
    {
        $connNum = count($this->getNsqdConns());
        if ($connNum === 0) {
            return 0;
        }
        $max = $this->maxInFlight;
        $per = $this->maxInFlight / $connNum;
        return intval(min(max(1, $per), $max));
    }