private function insertByes(Collection $fighters, $numByeTotal)
    {
        $bye = $this->createByeFighter();
        $groupSize = $this->firstRoundGroupSize();
        $frequency = $groupSize != 0
            ? (int)floor(count($fighters) / $groupSize / $groupSize)
            : -1;
        if ($frequency < $groupSize) {
            $frequency = $groupSize;
        }

        $newFighters = new Collection();
        $count = 0;
        $byeCount = 0;
        foreach ($fighters as $fighter) {
            // Each $frequency(3) try to insert $groupSize byes (3)
            // Not the first iteration, and at the good frequency, and with $numByeTotal as limit
            if ($this->shouldInsertBye($frequency, $count, $byeCount, $numByeTotal)) { //
                for ($i = 0; $i < $groupSize; $i++) {
                    if ($byeCount < $numByeTotal) {
                        $newFighters->push($bye);
                        $byeCount++;
                    }
                }
            }
            $newFighters->push($fighter);
            $count++;
        }
        return $newFighters;
    }
private function insertByes(Collection $fighters, $numByeTotal)
    {
        $bye = $this->createByeFighter();
        $groupSize = $this->firstRoundGroupSize();
        $frequency = $groupSize != 0
            ? (int)floor(count($fighters) / $groupSize / $groupSize)
            : -1;
        if ($frequency < $groupSize) {
            $frequency = $groupSize;
        }

        $newFighters = new Collection();
        $count = 0;
        $byeCount = 0;
        foreach ($fighters as $fighter) {
            // Each $frequency(3) try to insert $groupSize byes (3)
            // Not the first iteration, and at the good frequency, and with $numByeTotal as limit
            if ($this->shouldInsertBye($frequency, $count, $byeCount, $numByeTotal)) { //
                for ($i = 0; $i < $groupSize; $i++) {
                    if ($byeCount < $numByeTotal) {
                        $newFighters->push($bye);
                        $byeCount++;
                    }
                }
            }
            $newFighters->push($fighter);
            $count++;
        }
        return $newFighters;
    }
private function insertByes ( Collection $ fighters , $ numByeTotal ) { $ bye = $ this -> createByeFighter ( ) ; $ groupSize = $ this -> firstRoundGroupSize ( ) ; $ frequency = $ groupSize != 0 ? ( int ) floor ( count ( $ fighters ) / $ groupSize / $ groupSize ) : - 1 ; if ( $ frequency < $ groupSize ) { $ frequency = $ groupSize ; } $ newFighters = new Collection ( ) ; $ count = 0 ; $ byeCount = 0 ; foreach ( $ fighters as $ fighter ) { // Each $frequency(3) try to insert $groupSize byes (3) // Not the first iteration, and at the good frequency, and with $numByeTotal as limit if ( $ this -> shouldInsertBye ( $ frequency , $ count , $ byeCount , $ numByeTotal ) ) { // for ( $ i = 0 ; $ i < $ groupSize ; $ i ++ ) { if ( $ byeCount < $ numByeTotal ) { $ newFighters -> push ( $ bye ) ; $ byeCount ++ ; } } } $ newFighters -> push ( $ fighter ) ; $ count ++ ; } return $ newFighters ; }
Insert byes group alternated with full groups.

@param Collection $fighters - List of fighters
@param integer $numByeTotal - Quantity of byes to insert
@return Collection - Full list of fighters including byes
Insert byes group alternated with full groups .