_supportedOptions & $option) == $option; } protected function validateTeamCountAndPlayersCountPerTeam(array $teamsOfPlayerToRatings) { self::validateTeamCountAndPlayersCountPerTeamWithRanges($teamsOfPlayerToRatings, $this->_totalTeamsAllowed, $this->_playersPerTeamAllowed); } /** * @param array<\DNW\Skills\Team> $teams * @return void * @throws \Exception */ private static function validateTeamCountAndPlayersCountPerTeamWithRanges(array $teams, TeamsRange $totalTeams, PlayersRange $playersPerTeam) { $countOfTeams = 0; foreach ($teams as $currentTeam) { if (! $playersPerTeam->isInRange($currentTeam->count())) { throw new Exception('Player count is not in range'); } $countOfTeams++; } if (! $totalTeams->isInRange($countOfTeams)) { throw new Exception('Team range is not in range'); } } } class SkillCalculatorSupportedOptions { final const NONE = 0x00; final const PARTIAL_PLAY = 0x01; final const PARTIAL_UPDATE = 0x02; }