/** * @param LifecycleEventArgs $args */ public function prePersist(LifecycleEventArgs $args) { /** @var GameMatch $gameMatch */ if (!($gameMatch = $args->getObject()) instanceof GameMatch) { return; } $playerChoice = $gameMatch->getPlayerChoice(); $computerChoice = $gameMatch->getComputerChoice(); $result = $this->resultProvider->getResult($playerChoice, $computerChoice); $gameMatch->setOutcome($this->resultProvider->getOutcome($result)); }
/** * @param integer $outcome * * @return string */ public function formatWinner($outcome) { return $this->resultProvider->formatOutcome($outcome); }