1.6 KiB
1.6 KiB
public Election::addCandidate
Description
public Election->addCandidate ( [CondorcetPHP\Condorcet\Candidate|string|null $candidate = null] ): CondorcetPHP\Condorcet\Candidate
Add one candidate to an election.
candidate: CondorcetPHP\Condorcet\Candidate|string|null
Alphanumeric string or CondorcetPHP\Condorcet\Candidate object. The whitespace of your candidate name will be trimmed. If null, this function will create a new candidate with an automatic name.
Return value:
(CondorcetPHP\Condorcet\Candidate
) The new candidate object (your or automatic one). Throws an exception on error (existing candidate...).
Throws:
CondorcetPHP\Condorcet\Throwable\CandidateExistsException
CondorcetPHP\Condorcet\Throwable\VotingHasStartedException
Related method(s)
- Election::parseCandidates
- Election::addCandidatesFromJson
- Election::removeCandidate
- Election::getCandidatesList
- Election::canAddCandidate