/** * Verify that the form data was not manipulated * * @param Combination $combination * @param VoteCombination $voteCombination * * @return boolean */ private function verifyFormData(Combination $combination, VoteCombination $voteCombination) { // check if the competition matches if ($combination->getCompetition() !== $voteCombination->getCompetition()) { return false; } // check if the combination matches if ($combination !== $voteCombination->getCombination()) { return false; } // check if the voteForPicture is a valid option if (!in_array($voteCombination->getVoteForPicture(), $combination->getPictures())) { return false; } return true; }