protected function getDeadPlacesFromRoundPlayed(Round $round): array {
        $deadPlaces = [];

        $multipleRules = array_filter( $round->getToQualifyRules(), function( $toRule ) { return $toRule->isMultiple(); } );
        $multipleWinnersRules = array_filter( $multipleRules, function( $toRule ) { return $toRule->getWinnersOrLosers() === Round::WINNERS; } );
        $multipleWinnersRule = reset( $multipleWinnersRules );
        $multipleLosersRules = array_filter( $multipleRules, function( $toRule ) { return $toRule->getWinnersOrLosers() === Round::LOSERS; } );
        $multipleLosersRule = reset( $multipleLosersRules );

        $nrOfUniqueFromPlacesMultiple = count( $this->getUniqueFromPlaces($multipleRules));
        if ($multipleWinnersRule !== false) {
            $qualifyAmount = count( $multipleWinnersRule->getToPoulePlaces() );
            $rankingItems = $this->getRankingItemsForMultipleRule($multipleWinnersRule);
            for ($i = 0; $i < $qualifyAmount; $i++) {
                $nrOfUniqueFromPlacesMultiple--;
                array_shift( $rankingItems);
            }
            $amountQualifyLosers = $multipleLosersRule !== false ? count($multipleLosersRule->getToPoulePlaces()) : 0;
            while ($nrOfUniqueFromPlacesMultiple - $amountQualifyLosers > 0) {
                $nrOfUniqueFromPlacesMultiple--;
                $deadPlaces[] = array_shift($rankingItems)->getPoulePlace();
            }
        }
        $poulePlacesPer = $this->getPoulePlacesPer($round);
        foreach( $poulePlacesPer as $poulePlaces ) {
            if ($round->getWinnersOrLosers() === Round::LOSERS) {
                $poulePlaces = array_reverse($poulePlaces);
            }
            $deadPlacesPer = array_filter( $poulePlaces, function( $poulePlace ) {
                return count($poulePlace->getToQualifyRules()) === 0;
            });
            foreach( $this->getDeadPlacesFromPlaceNumber($deadPlacesPer, $round) as $deadPoulePlace ) {
                $deadPlaces[] = $deadPoulePlace;
            }
        }
        if ($multipleLosersRule !== false) {
            $qualifyAmount = count($multipleLosersRule->getToPoulePlaces());
            $rankingItems = $this->getRankingItemsForMultipleRule($multipleLosersRule);
            for ($i = 0; $i < $qualifyAmount; $i++) {
                $nrOfUniqueFromPlacesMultiple--;
                array_pop($rankingItems);
            }
            while ($nrOfUniqueFromPlacesMultiple) {
                $nrOfUniqueFromPlacesMultiple--;
                $deadPlaces[] = array_pop($rankingItems)->getPoulePlace();
            }
        }
        return $deadPlaces;
    }
protected function getDeadPlacesFromRoundPlayed(Round $round): array {
        $deadPlaces = [];

        $multipleRules = array_filter( $round->getToQualifyRules(), function( $toRule ) { return $toRule->isMultiple(); } );
        $multipleWinnersRules = array_filter( $multipleRules, function( $toRule ) { return $toRule->getWinnersOrLosers() === Round::WINNERS; } );
        $multipleWinnersRule = reset( $multipleWinnersRules );
        $multipleLosersRules = array_filter( $multipleRules, function( $toRule ) { return $toRule->getWinnersOrLosers() === Round::LOSERS; } );
        $multipleLosersRule = reset( $multipleLosersRules );

        $nrOfUniqueFromPlacesMultiple = count( $this->getUniqueFromPlaces($multipleRules));
        if ($multipleWinnersRule !== false) {
            $qualifyAmount = count( $multipleWinnersRule->getToPoulePlaces() );
            $rankingItems = $this->getRankingItemsForMultipleRule($multipleWinnersRule);
            for ($i = 0; $i < $qualifyAmount; $i++) {
                $nrOfUniqueFromPlacesMultiple--;
                array_shift( $rankingItems);
            }
            $amountQualifyLosers = $multipleLosersRule !== false ? count($multipleLosersRule->getToPoulePlaces()) : 0;
            while ($nrOfUniqueFromPlacesMultiple - $amountQualifyLosers > 0) {
                $nrOfUniqueFromPlacesMultiple--;
                $deadPlaces[] = array_shift($rankingItems)->getPoulePlace();
            }
        }
        $poulePlacesPer = $this->getPoulePlacesPer($round);
        foreach( $poulePlacesPer as $poulePlaces ) {
            if ($round->getWinnersOrLosers() === Round::LOSERS) {
                $poulePlaces = array_reverse($poulePlaces);
            }
            $deadPlacesPer = array_filter( $poulePlaces, function( $poulePlace ) {
                return count($poulePlace->getToQualifyRules()) === 0;
            });
            foreach( $this->getDeadPlacesFromPlaceNumber($deadPlacesPer, $round) as $deadPoulePlace ) {
                $deadPlaces[] = $deadPoulePlace;
            }
        }
        if ($multipleLosersRule !== false) {
            $qualifyAmount = count($multipleLosersRule->getToPoulePlaces());
            $rankingItems = $this->getRankingItemsForMultipleRule($multipleLosersRule);
            for ($i = 0; $i < $qualifyAmount; $i++) {
                $nrOfUniqueFromPlacesMultiple--;
                array_pop($rankingItems);
            }
            while ($nrOfUniqueFromPlacesMultiple) {
                $nrOfUniqueFromPlacesMultiple--;
                $deadPlaces[] = array_pop($rankingItems)->getPoulePlace();
            }
        }
        return $deadPlaces;
    }
protected function getDeadPlacesFromRoundPlayed ( Round $ round ) : array { $ deadPlaces = [ ] ; $ multipleRules = array_filter ( $ round -> getToQualifyRules ( ) , function ( $ toRule ) { return $ toRule -> isMultiple ( ) ; } ) ; $ multipleWinnersRules = array_filter ( $ multipleRules , function ( $ toRule ) { return $ toRule -> getWinnersOrLosers ( ) === Round :: WINNERS ; } ) ; $ multipleWinnersRule = reset ( $ multipleWinnersRules ) ; $ multipleLosersRules = array_filter ( $ multipleRules , function ( $ toRule ) { return $ toRule -> getWinnersOrLosers ( ) === Round :: LOSERS ; } ) ; $ multipleLosersRule = reset ( $ multipleLosersRules ) ; $ nrOfUniqueFromPlacesMultiple = count ( $ this -> getUniqueFromPlaces ( $ multipleRules ) ) ; if ( $ multipleWinnersRule !== false ) { $ qualifyAmount = count ( $ multipleWinnersRule -> getToPoulePlaces ( ) ) ; $ rankingItems = $ this -> getRankingItemsForMultipleRule ( $ multipleWinnersRule ) ; for ( $ i = 0 ; $ i < $ qualifyAmount ; $ i ++ ) { $ nrOfUniqueFromPlacesMultiple -- ; array_shift ( $ rankingItems ) ; } $ amountQualifyLosers = $ multipleLosersRule !== false ? count ( $ multipleLosersRule -> getToPoulePlaces ( ) ) : 0 ; while ( $ nrOfUniqueFromPlacesMultiple - $ amountQualifyLosers > 0 ) { $ nrOfUniqueFromPlacesMultiple -- ; $ deadPlaces [ ] = array_shift ( $ rankingItems ) -> getPoulePlace ( ) ; } } $ poulePlacesPer = $ this -> getPoulePlacesPer ( $ round ) ; foreach ( $ poulePlacesPer as $ poulePlaces ) { if ( $ round -> getWinnersOrLosers ( ) === Round :: LOSERS ) { $ poulePlaces = array_reverse ( $ poulePlaces ) ; } $ deadPlacesPer = array_filter ( $ poulePlaces , function ( $ poulePlace ) { return count ( $ poulePlace -> getToQualifyRules ( ) ) === 0 ; } ) ; foreach ( $ this -> getDeadPlacesFromPlaceNumber ( $ deadPlacesPer , $ round ) as $ deadPoulePlace ) { $ deadPlaces [ ] = $ deadPoulePlace ; } } if ( $ multipleLosersRule !== false ) { $ qualifyAmount = count ( $ multipleLosersRule -> getToPoulePlaces ( ) ) ; $ rankingItems = $ this -> getRankingItemsForMultipleRule ( $ multipleLosersRule ) ; for ( $ i = 0 ; $ i < $ qualifyAmount ; $ i ++ ) { $ nrOfUniqueFromPlacesMultiple -- ; array_pop ( $ rankingItems ) ; } while ( $ nrOfUniqueFromPlacesMultiple ) { $ nrOfUniqueFromPlacesMultiple -- ; $ deadPlaces [ ] = array_pop ( $ rankingItems ) -> getPoulePlace ( ) ; } } return $ deadPlaces ; }
1 pak weer de unique plaatsen
2 bepaal wie er doorgaan van de winnaars en haal deze eraf
3 doe de plekken zonder to - regels
4 bepaal wie er doorgaan van de verliezers en haal deze eraf
5 voeg de overgebleven plekken toe aan de deadplaces

@param Round $round
@return array | PoulePlace[]
1 pak weer de unique plaatsen 2 bepaal wie er doorgaan van de winnaars en haal deze eraf 3 doe de plekken zonder to - regels 4 bepaal wie er doorgaan van de verliezers en haal deze eraf 5 voeg de overgebleven plekken toe aan de deadplaces