-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
NoTie.php
30 lines (23 loc) · 865 Bytes
/
NoTie.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/*
Condorcet PHP - Election manager and results calculator.
Designed for the Condorcet method. Integrating a large number of algorithms extending Condorcet. Expandable for all types of voting systems.
By Julien Boudry and contributors - MIT LICENSE (Please read LICENSE.txt)
https://github.com/julien-boudry/Condorcet
*/
declare(strict_types=1);
namespace CondorcetPHP\Condorcet\Constraints;
use CondorcetPHP\Condorcet\{Election, Vote, VoteConstraintInterface};
class NoTie 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;
}
}