/** * Regenerate game pieces for the given variant * * @return null **/ public function applyVariant(Game $game, $variant) { if ($game->getIsStarted()) { throw new LogicException('Can not apply variant to a started game'); } if ($game->getVariant() === $variant) { return $game; } $game->setVariant($variant); $this->getVariantGenerator($variant)->createPieces($game); }