Create a new Votes Constraints
Read at votes constraints chapter
Alternative possible implementation of NoTie
namespace YOUR_NAMESPACE;
use CondorcetPHP\Condorcet\{Election, Vote, VoteConstraintInterface};
class NoTieAlternative implements VoteConstraintInterface
{
public static function isVoteAllow (Election $election, Vote $vote) : bool
{
$voteRanking = $vote->getContextualRankingWithoutSort($election);
foreach ($voteRanking as $oneRank) {
if (\count($oneRank) > 1) {
return false;
}
}
return true;
}
}
Then ⇒
$election->addConstraint(NoTieAlternative::class);