Skip to content

Extending Candidate & Vote Class

Vote & Candidate classes are ready to be extended. But no interface is provided due to the high complexity.

php
use CondorcetPHP\Condorcet\Candidate;
use CondorcetPHP\Condorcet\Vote;
use CondorcetPHP\Condorcet\Election;

class yourVoteClass extends Vote {
    // ...
}

class yourCandidateClass extends Candidate {
    // ...
}

$election = new Election;

$election->addCandidate(new yourCandidateClass('A'));
$election->addCandidate(new yourCandidateClass('B'));
$election->addCandidate(new yourCandidateClass('C'));

$election->addVote(new yourVoteClass('A>B>C'));

//...

Please read the class. And ask for support if needed.

Released under the MIT License.