/** * @inheritDoc */ public function getRound() { if (null !== $this->previousRound && !$this->previousRound->isRoundCompleted()) { // previous round not complete, initializing this round would probably fail return null; } if (!$this->isRoundInitialized) { $this->initializeRoundEntity($this->round); $this->isRoundInitialized = true; } return $this->round; }
/** * @inheritDoc */ public function filter(RoundGearsInterface $previousRoundGears) { if (!$previousRoundGears->isRoundCompleted()) { throw new \RuntimeException(); } $advance = $previousRoundGears->getSetup()->getAdvance(); $leaderBoard = $previousRoundGears->getLeaderBoard(); $output = array(); foreach ($leaderBoard->getEntries() as $groupNumber => $entries) { /** @var LeaderBoardEntryInterface[] $entries */ $output[$groupNumber] = array(); foreach ($entries as $entry) { if (-1 != $advance && count($output[$groupNumber]) >= $advance) { break; } $output[$groupNumber][] = $entry->getPlayer(); } } return $output; }